Merged revisions 86003 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86003 | brian.curtin | 2010-10-30 19:03:45 -0500 (Sat, 30 Oct 2010) | 2 lines

  Fix ResourceWarning. Use context manager to properly close file.
........
This commit is contained in:
Brian Curtin 2010-10-31 00:05:24 +00:00
parent 46805e9102
commit a813a638ef
1 changed files with 11 additions and 10 deletions

View File

@ -401,7 +401,8 @@ class FormatTestCase(unittest.TestCase):
@unittest.skipUnless(float.__getformat__("double").startswith("IEEE"),
"test requires IEEE 754 doubles")
def test_format_testfile(self):
for line in open(format_testfile):
with open(format_testfile) as testfile:
for line in testfile:
if line.startswith('--'):
continue
line = line.strip()