MCPcopy Index your code
hub / github.com/python/cpython / test_parse_close_source

Method test_parse_close_source

Lib/test/test_sax.py:204–217  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

202 self.check_parse(input)
203
204 def test_parse_close_source(self):
205 builtin_open = open
206 fileobj = None
207
208 def mock_open(*args):
209 nonlocal fileobj
210 fileobj = builtin_open(*args)
211 return fileobj
212
213 with mock.patch('xml.sax.saxutils.open', side_effect=mock_open):
214 make_xml_file(self.data, 'iso-8859-1', None)
215 with self.assertRaises(SAXException):
216 self.check_parse(TESTFN)
217 self.assertTrue(fileobj.closed)
218
219 def check_parseString(self, s):
220 from xml.sax import parseString

Callers

nothing calls this directly

Calls 4

check_parseMethod · 0.95
make_xml_fileFunction · 0.85
assertTrueMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected