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

Method test_namespace

Lib/test/test_xml_etree.py:1117–1148  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1115 'undefined entity &entity;: line 4, column 10')
1116
1117 def test_namespace(self):
1118 # Test namespace issues.
1119
1120 # 1) xml namespace
1121
1122 elem = ET.XML("<tag xml:lang='en' />")
1123 self.serialize_check(elem, '<tag xml:lang="en" />') # 1.1
1124
1125 # 2) other "well-known" namespaces
1126
1127 elem = ET.XML("<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' />")
1128 self.serialize_check(elem,
1129 '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" />') # 2.1
1130
1131 elem = ET.XML("<html:html xmlns:html='http://www.w3.org/1999/xhtml' />")
1132 self.serialize_check(elem,
1133 '<html:html xmlns:html="http://www.w3.org/1999/xhtml" />') # 2.2
1134
1135 elem = ET.XML("<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope' />")
1136 self.serialize_check(elem,
1137 '<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope" />') # 2.3
1138
1139 # 3) unknown namespaces
1140 elem = ET.XML(SAMPLE_XML_NS)
1141 self.serialize_check(elem,
1142 '<ns0:body xmlns:ns0="http://effbot.org/ns">\n'
1143 ' <ns0:tag>text</ns0:tag>\n'
1144 ' <ns0:tag />\n'
1145 ' <ns0:section>\n'
1146 ' <ns0:tag>subtext</ns0:tag>\n'
1147 ' </ns0:section>\n'
1148 '</ns0:body>')
1149
1150 def test_qname(self):
1151 # Test QName handling.

Callers

nothing calls this directly

Calls 1

serialize_checkMethod · 0.95

Tested by

no test coverage detected