diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 22:14:36 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 22:14:36 (GMT) |
commit | ea5d827b729e425751428153318ecc348cc0be50 (patch) | |
tree | 1997afdc83eb0dca7c00c11a71419579e94b871a /Lib/test/test_decimal.py | |
parent | 3d400b7a58a9f6e338048593ae19ab3cc92a8cd3 (diff) | |
download | cpython-ea5d827b729e425751428153318ecc348cc0be50.zip cpython-ea5d827b729e425751428153318ecc348cc0be50.tar.gz cpython-ea5d827b729e425751428153318ecc348cc0be50.tar.bz2 |
Merged revisions 85503 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85503 | antoine.pitrou | 2010-10-15 00:11:44 +0200 (ven., 15 oct. 2010) | 2 lines
More proper closing of files
........
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 e9fbad4..9467191 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -218,14 +218,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 |