diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 22:22:30 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-14 22:22:30 +0000 |
commit | 99d848bd4ba7bc0df689709f3854d67c6d82a757 (patch) | |
tree | d02592b257cb7411854f5f49e904b054af391a90 /Lib/test/test_decimal.py | |
parent | 80800d35713912eb4b9486033c1ce86bce263728 (diff) | |
download | cpython-git-99d848bd4ba7bc0df689709f3854d67c6d82a757.tar.gz |
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 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 |