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 testSimpleException(self): content = None instance = trac26.eCTwSC(4) with self.assertRaises(pyxb.NotComplexContentError) as cm: content = instance.orderedContent() e = cm.exception self.assertEqual(e.instance, instance)
def testException (self): instance = trac26.eCTwSC(4) with self.assertRaises(pyxb.NoNillableSupportError) as cm: instance._setIsNil(True) e = cm.exception self.assertTrue(e.location is None) self.assertEqual(e.instance, instance)
def testException(self): instance = trac26.eCTwSC(4) with self.assertRaises(pyxb.NoNillableSupportError) as cm: instance._setIsNil(True) e = cm.exception self.assertTrue(e.location is None) self.assertEqual(e.instance, instance)
def testSimpleException (self): content = None instance = trac26.eCTwSC(4) with self.assertRaises(pyxb.NotComplexContentError) as cm: content = instance.orderedContent() e = cm.exception self.assertEqual(e.instance, instance)
def testException(self): instance = trac26.eCTwSC(4) with self.assertRaises(pyxb.ReservedNameError) as cm: instance.toxml = 1 e = cm.exception self.assertEqual(e.instance, instance) self.assertEqual(e.name, 'toxml')
def testSchemaSupport (self): instance = trac26.eCTwSC(1) self.assertTrue(instance.validateBinding()) instance.reset() self.assertRaises(pyxb.SimpleContentAbsentError, instance.validateBinding) instance.append(1) self.assertTrue(instance.validateBinding())
def testException (self): instance = trac26.eCTwSC(4) with self.assertRaises(pyxb.ReservedNameError) as cm: instance.toxml = 1 e = cm.exception self.assertEqual(e.instance, instance) self.assertEqual(e.name, 'toxml')
def testAfterReset(self): instance = trac26.eCTwSC(3) self.assertTrue(instance.validateBinding()) instance.reset() with self.assertRaises(pyxb.SimpleContentAbsentError) as cm: instance.validateBinding() e = cm.exception self.assertEqual(str(e), 'Type tCTwSC requires content')
def testSchemaSupport(self): instance = trac26.eCTwSC(1) self.assertTrue(instance.validateBinding()) instance.reset() self.assertRaises(pyxb.SimpleContentAbsentError, instance.validateBinding) instance.append(1) self.assertTrue(instance.validateBinding())
def testAfterReset (self): instance = trac26.eCTwSC(3) self.assertTrue(instance.validateBinding()) instance.reset() with self.assertRaises(pyxb.SimpleContentAbsentError) as cm: instance.validateBinding() e = cm.exception self.assertEqual(str(e), 'Type tCTwSC requires content')
def testException (self): instance = trac26.eCTwSC(1) with self.assertRaises(pyxb.ExtraSimpleContentError) as cm: instance.append(2) e = cm.exception self.assertEqual(e.instance, instance) self.assertEqual(e.value, 2) self.assertTrue(e.location is None) self.assertEqual(str(e), 'Instance of tCTwSC already has simple content value assigned')
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 testException(self): instance = trac26.eCTwSC(1) with self.assertRaises(pyxb.ExtraSimpleContentError) as cm: instance.append(2) e = cm.exception self.assertEqual(e.instance, instance) self.assertEqual(e.value, 2) self.assertTrue(e.location is None) self.assertEqual( str(e), 'Instance of tCTwSC already has simple content value assigned')
def testException (self): instance = trac26.eIntsPlus() with self.assertRaises(pyxb.UnrecognizedContentError) as cm: instance.append(trac26.eCTwSC(2)) e = cm.exception self.assertTrue(e.location is None) self.assertTrue(e.automaton_configuration is not None) self.assertTrue(isinstance(e.value, trac26.tCTwSC)) acceptable = e.automaton_configuration.acceptableContent() self.assertEqual(2, len(acceptable)) self.assertTrue(isinstance(acceptable[0], pyxb.binding.content.ElementUse)) self.assertNotEqual(acceptable[0].elementBinding(), trac26.eInt) self.assertEqual(acceptable[0].typeDefinition(), trac26.eInt.typeDefinition()) self.assertTrue(isinstance(acceptable[1], pyxb.binding.content.WildcardUse)) self.assertEqual(str(e), 'Invalid content eCTwSC (expect eInt or xs:any)') self.assertEqual(e.details(), self.Bad_details)
def testException(self): instance = trac26.eIntsPlus() with self.assertRaises(pyxb.UnrecognizedContentError) as cm: instance.append(trac26.eCTwSC(2)) e = cm.exception self.assertTrue(e.location is None) self.assertTrue(e.automaton_configuration is not None) self.assertTrue(isinstance(e.value, trac26.tCTwSC)) acceptable = e.automaton_configuration.acceptableContent() self.assertEqual(2, len(acceptable)) self.assertTrue( isinstance(acceptable[0], pyxb.binding.content.ElementUse)) self.assertNotEqual(acceptable[0].elementBinding(), trac26.eInt) self.assertEqual(acceptable[0].typeDefinition(), trac26.eInt.typeDefinition()) self.assertTrue( isinstance(acceptable[1], pyxb.binding.content.WildcardUse)) self.assertEqual(str(e), 'Invalid content eCTwSC (expect eInt or xs:any)') self.assertEqual(e.details(), self.Bad_details)
def testDisplayExceptionReset (self): if DisplayException: instance = trac26.eCTwSC(3) instance.reset() instance.validateBinding()
def testDisplayExceptionXsdConstraints(self): if DisplayException: instance = trac26.eCTwSC(3) instance.reset() instance.xsdConstraintsOK()
def testDisplayExceptionReset(self): if DisplayException: instance = trac26.eCTwSC(3) instance.reset() instance.validateBinding()
def testDisplayException(self): if DisplayException: instance = trac26.eCTwSC()
def testDisplay (self): if DisplayException: instance = trac26.eInts() instance.append(trac26.eCTwSC(2))
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): instance = trac26.eCTwSC(1) if DisplayException: instance.append(2)
def testSchemaSupport (self): instance = trac26.eEmpty() instance = trac26.eCTwSC(4)
def testDisplayException (self): if DisplayException: trac26.eCTwSC(4).toxml = 1
def testSchemaSupport(self): instance = trac26.eEmpty() instance = trac26.eCTwSC(4)
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.eInts() instance.append(trac26.eCTwSC(2))
def testDisplayException (self): if DisplayException: instance = trac26.eCTwSC()
def testDisplay(self): instance = trac26.eCTwSC(1) if DisplayException: instance.append(2)
def testDisplayException(self): if DisplayException: trac26.eCTwSC(4).toxml = 1
def testDirect (self): instance = None with self.assertRaises(pyxb.SimpleContentAbsentError) as cm: instance = trac26.eCTwSC() e = cm.exception self.assertTrue(instance is None)
def testDirect(self): instance = None with self.assertRaises(pyxb.SimpleContentAbsentError) as cm: instance = trac26.eCTwSC() e = cm.exception self.assertTrue(instance is None)
def testDisplayExceptionXsdConstraints (self): if DisplayException: instance = trac26.eCTwSC(3) instance.reset() instance.xsdConstraintsOK()
def testDisplay (self): if DisplayException: instance = trac26.eCTwSCSequence() instance.append(trac26.eCTwSC(2)) instance.append('noise')
def testSchemaSupport (self): instance = trac26.eCTwSC(4) instance.nottoxml = 1
def testSchemaSupport(self): instance = trac26.eCTwSC(4) instance.nottoxml = 1