MCPcopy Create free account
hub / github.com/sissaschool/xmlschema / test_xsd_element_binding

Method test_xsd_element_binding

tests/test_dataobjects.py:135–146  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

133 self.assertEqual(data_element.xsd_version, self.col_schema.XSD_VERSION)
134
135 def test_xsd_element_binding(self):
136 xsd_element = self.col_schema.elements['person']
137 data_element = DataElement(tag=self.col_xml_root.tag, xsd_element=xsd_element)
138 data_element.xsd_element = xsd_element
139
140 with self.assertRaises(TypeError) as ec:
141 DataElement(tag=xsd_element.name, xsd_element=self.col_schema)
142 self.assertIn("invalid type for attribute 'xsd_element'", str(ec.exception))
143
144 with self.assertRaises(ValueError) as ec:
145 data_element.xsd_element = self.col_schema.elements['collection']
146 self.assertIn('the instance is already bound to another XSD element', str(ec.exception))
147
148 def test_xsd_type_binding(self):
149 xsd_type = self.col_schema.elements['person'].type

Callers

nothing calls this directly

Calls 1

DataElementClass · 0.90

Tested by

no test coverage detected