def testDOM(self): dom = pyxb.utils.domutils.StringToDOM(self.Bad_xmlt) with self.assertRaises(pyxb.UnrecognizedAttributeError) as cm: instance = trac26.CreateFromDOM(dom) e = cm.exception # The code path for this is creating a map from attribute tags # to values in isolation of the specific instance. A # partially-constructed instance is available, but the # location is not available. self.assertEqual(e.type, trac26.tAttributes) self.assertEqual(e.tag, 'aBad') self.assertTrue(e.instance is not None) self.assertTrue(isinstance(e.instance, e.type)) self.assertTrue(e.location is None)
def testDisplayDOM(self): if DisplayException: trac26.CreateFromDOM(pyxb.utils.domutils.StringToDOM( self.Bad_xmlt))
def testSchemaSupport(self): dom = pyxb.utils.domutils.StringToDOM(self.Good_xmlt) instance = trac26.CreateFromDOM(dom) self.assertEqual(self.Good_xmld, instance.toxml('utf-8', root_only=True))