summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_minidom.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2010-10-30 00:14:59 (GMT)
committerBrett Cannon <bcannon@gmail.com>2010-10-30 00:14:59 (GMT)
commitc524692c88a7d5b970881237a4feded79fa41b29 (patch)
tree4aee35fec1e1483c12b0e8e3457f1dbc0724afaa /Lib/test/test_minidom.py
parent653238a88db15c36a63ca70620f79ecd4b799d01 (diff)
downloadcpython-c524692c88a7d5b970881237a4feded79fa41b29.zip
cpython-c524692c88a7d5b970881237a4feded79fa41b29.tar.gz
cpython-c524692c88a7d5b970881237a4feded79fa41b29.tar.bz2
Properly close a file in test_minidom.
Diffstat (limited to 'Lib/test/test_minidom.py')
-rw-r--r--Lib/test/test_minidom.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index 97668d3..7b845ef 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -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)