mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
More proper closing of files
This commit is contained in:
parent
73315e9200
commit
92f60ed82a
7 changed files with 82 additions and 57 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue