summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_difflib.py
diff options
context:
space:
mode:
authorPhilip Jenvey <pjenvey@underboss.org>2009-05-28 05:58:44 (GMT)
committerPhilip Jenvey <pjenvey@underboss.org>2009-05-28 05:58:44 (GMT)
commit6a111027f2c1607d3e03acee6256eef38fafb206 (patch)
tree02725b4ef18fc23ba7ccb421f4ab388cab7cc0b9 /Lib/test/test_difflib.py
parentdd0388a1c218d1ae2074d56b19e8e765a254c938 (diff)
downloadcpython-6a111027f2c1607d3e03acee6256eef38fafb206.zip
cpython-6a111027f2c1607d3e03acee6256eef38fafb206.tar.gz
cpython-6a111027f2c1607d3e03acee6256eef38fafb206.tar.bz2
explicitly close files
Diffstat (limited to 'Lib/test/test_difflib.py')
-rw-r--r--Lib/test/test_difflib.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_difflib.py b/Lib/test/test_difflib.py
index 83fad15..011ef17 100644
--- a/Lib/test/test_difflib.py
+++ b/Lib/test/test_difflib.py
@@ -135,14 +135,13 @@ class TestSFpatches(unittest.TestCase):
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.