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

Method testSchemaType

Lib/test/test_minidom.py:1532–1563  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1530 and len(elem.childNodes) == 2)
1531
1532 def testSchemaType(self):
1533 doc = parseString(
1534 "<!DOCTYPE doc [\n"
1535 " <!ENTITY e1 SYSTEM 'http://xml.python.org/e1'>\n"
1536 " <!ENTITY e2 SYSTEM 'http://xml.python.org/e2'>\n"
1537 " <!ATTLIST doc id ID #IMPLIED \n"
1538 " ref IDREF #IMPLIED \n"
1539 " refs IDREFS #IMPLIED \n"
1540 " enum (a|b) #IMPLIED \n"
1541 " ent ENTITY #IMPLIED \n"
1542 " ents ENTITIES #IMPLIED \n"
1543 " nm NMTOKEN #IMPLIED \n"
1544 " nms NMTOKENS #IMPLIED \n"
1545 " text CDATA #IMPLIED \n"
1546 " >\n"
1547 "]><doc id='name' notid='name' text='splat!' enum='b'"
1548 " ref='name' refs='name name' ent='e1' ents='e1 e2'"
1549 " nm='123' nms='123 abc' />")
1550 elem = doc.documentElement
1551 # We don't want to rely on any specific loader at this point, so
1552 # just make sure we can get to all the names, and that the
1553 # DTD-based namespace is right. The names can vary by loader
1554 # since each supports a different level of DTD information.
1555 t = elem.schemaType
1556 self.confirm(t.name is None
1557 and t.namespace == xml.dom.EMPTY_NAMESPACE)
1558 names = "id notid text enum ref refs ent ents nm nms".split()
1559 for name in names:
1560 a = elem.getAttributeNode(name)
1561 t = a.schemaType
1562 self.confirm(hasattr(t, "name")
1563 and t.namespace == xml.dom.EMPTY_NAMESPACE)
1564
1565 def testSetIdAttribute(self):
1566 doc = parseString("<doc a1='v' a2='w'/>")

Callers

nothing calls this directly

Calls 4

confirmMethod · 0.95
parseStringFunction · 0.90
getAttributeNodeMethod · 0.80
splitMethod · 0.45

Tested by

no test coverage detected