def testException (self): instance = trac26.eCTwSCSequence() instance.append(trac26.eCTwSC(2)) with self.assertRaises(pyxb.MixedContentError) as cm: instance.append('noise') e = cm.exception self.assertTrue(e.location is None) self.assertEqual(e.instance, instance) self.assertEqual(e.value, 'noise') self.assertEqual(str(e), 'Invalid non-element content')
def testException(self): instance = trac26.eCTwSCSequence() instance.append(trac26.eCTwSC(2)) with self.assertRaises(pyxb.MixedContentError) as cm: instance.append('noise') e = cm.exception self.assertTrue(e.location is None) self.assertEqual(e.instance, instance) self.assertEqual(e.value, 'noise') self.assertEqual(str(e), 'Invalid non-element content')
def testSchemaSupport(self): instance = trac26.eCTwSC(3) self.assertEqual(3, instance.value()) instance = trac26.CreateFromDocument(self.Good_xmlt) self.assertEqual(3, instance.value()) instance = trac26.eCTwSCSequence() # Can't infer conversion, see trac/175 instance.eCTwSC.append(trac26.eCTwSC(1)) instance.eCTwSC.append(trac26.eCTwSC(2)) instance = trac26.CreateFromDocument(self.GoodSeq_xmlt) xmld = instance.toxml('utf-8', root_only=True) self.assertEqual(xmld, self.GoodSeq_xmld)
def testSchemaSupport (self): instance = trac26.eCTwSC(3) self.assertEqual(3, instance.value()) instance = trac26.CreateFromDocument(self.Good_xmlt) self.assertEqual(3, instance.value()) instance = trac26.eCTwSCSequence() # Can't infer conversion, see trac/175 instance.eCTwSC.append(trac26.eCTwSC(1)) instance.eCTwSC.append(trac26.eCTwSC(2)) instance = trac26.CreateFromDocument(self.GoodSeq_xmlt) xmld = instance.toxml('utf-8', root_only=True) self.assertEqual(xmld, self.GoodSeq_xmld)
def testDisplay(self): if DisplayException: instance = trac26.eCTwSCSequence() instance.append(trac26.eCTwSC(2)) instance.append('noise')
def testSchemaSupport(self): instance = trac26.eCTwSCSequence() instance.append(trac26.eCTwSC(2)) instance = trac26.CreateFromDocument(self.Good_xmlt) self.assertEqual(self.Good_xmld, instance.toxml('utf-8', root_only=True))
def testDisplay (self): if DisplayException: instance = trac26.eCTwSCSequence() instance.append(trac26.eCTwSC(2)) instance.append('noise')
def testSchemaSupport (self): instance = trac26.eCTwSCSequence() instance.append(trac26.eCTwSC(2)) instance = trac26.CreateFromDocument(self.Good_xmlt) self.assertEqual(self.Good_xmld, instance.toxml('utf-8', root_only=True))