diff options
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r-- | Lib/test/test_decimal.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index f8d8dec5ad..dc217779ee 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -224,14 +224,15 @@ class DecimalTest(unittest.TestCase): if skip_expected: raise unittest.SkipTest return - for line in open(file): - line = line.replace('\r\n', '').replace('\n', '') - #print line - try: - t = self.eval_line(line) - except DecimalException, exception: - #Exception raised where there shoudn't have been one. - self.fail('Exception "'+exception.__class__.__name__ + '" raised on line '+line) + with open(file) as f: + for line in f: + line = line.replace('\r\n', '').replace('\n', '') + #print line + try: + t = self.eval_line(line) + except DecimalException as exception: + #Exception raised where there shoudn't have been one. + self.fail('Exception "'+exception.__class__.__name__ + '" raised on line '+line) return |