summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r--Lib/test/test_decimal.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index 4a35465..a88da5b 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -225,14 +225,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 as 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