Properly close a file in test_minidom.

This commit is contained in:
Brett Cannon 2010-10-30 00:14:59 +00:00
parent 653238a88d
commit c524692c88

View file

@ -73,9 +73,10 @@ class MinidomTest(unittest.TestCase):
self.confirm(t == s, "looking for %s, found %s" % (repr(s), repr(t)))
def testParseFromFile(self):
dom = parse(open(tstfile))
dom.unlink()
self.confirm(isinstance(dom, Document))
with open(tstfile) as file:
dom = parse(file)
dom.unlink()
self.confirm(isinstance(dom, Document))
def testGetElementsByTagName(self):
dom = parse(tstfile)