Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_difflib.py @ 54389:70fb848870ac legacy-trunk
explicitly close files
| author | Philip Jenvey <pjenvey@underboss.org> |
|---|---|
| date | Thu, 28 May 2009 05:58:44 +0000 |
| parents | 0342c5f0f4ff |
| children | f554dfff7450 |
line wrap: on
line diff
--- a/Lib/test/test_difflib.py Thu May 28 03:12:16 2009 +0000 +++ b/Lib/test/test_difflib.py Thu May 28 05:58:44 2009 +0000 @@ -135,14 +135,13 @@ k.make_table(f3.splitlines(True),t3.splitlines(True)), ]) actual = full.replace('</body>','\n%s\n</body>' % tables) - # temporarily uncomment next three lines to baseline this test - #f = open('test_difflib_expect.html','w') - #f.write(actual) - #f.close() - expect = open(findfile('test_difflib_expect.html')).read() + # temporarily uncomment next two lines to baseline this test + #with open('test_difflib_expect.html','w') as fp: + # fp.write(actual) - self.assertEqual(actual,expect) + with open(findfile('test_difflib_expect.html')) as fp: + self.assertEqual(actual, fp.read()) def test_recursion_limit(self): # Check if the problem described in patch #1413711 exists.
