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

Method test_parse_uri

Lib/test/test_xml_dom_xmlbuilder.py:53–73  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

51 self.assertIsInstance(builder, xmlbuilder.DOMBuilder)
52
53 def test_parse_uri(self):
54 body = (
55 b"HTTP/1.1 200 OK\r\nContent-Type: text/xml; charset=utf-8\r\n\r\n"
56 + SMALL_SAMPLE
57 )
58
59 sock = FakeSocket(body)
60 response = client.HTTPResponse(sock)
61 response.begin()
62 attrs = {"open.return_value": response}
63 opener = mock.Mock(**attrs)
64
65 with mock.patch("urllib.request.build_opener") as mock_build:
66 mock_build.return_value = opener
67
68 imp = getDOMImplementation()
69 builder = imp.createDOMBuilder(imp.MODE_SYNCHRONOUS, None)
70 document = builder.parseURI("http://example.com/2000/svg")
71
72 self.assertIsInstance(document, minidom.Document)
73 self.assertEqual(len(document.childNodes), 1)
74
75 def test_parse_with_systemId(self):
76 response = io.BytesIO(SMALL_SAMPLE)

Callers

nothing calls this directly

Calls 7

beginMethod · 0.95
FakeSocketClass · 0.90
getDOMImplementationFunction · 0.90
createDOMBuilderMethod · 0.80
parseURIMethod · 0.80
assertIsInstanceMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected