示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
 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)
示例#7
0
 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')
示例#8
0
 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())
示例#9
0
 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')
示例#10
0
 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')
示例#11
0
 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())
示例#12
0
 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')
示例#13
0
 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')
示例#14
0
 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')
示例#15
0
 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')
示例#16
0
 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')
示例#17
0
 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)
示例#18
0
 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)
示例#19
0
 def testDisplayExceptionReset (self):
     if DisplayException:
         instance = trac26.eCTwSC(3)
         instance.reset()
         instance.validateBinding()
示例#20
0
 def testDisplayExceptionXsdConstraints(self):
     if DisplayException:
         instance = trac26.eCTwSC(3)
         instance.reset()
         instance.xsdConstraintsOK()
示例#21
0
 def testDisplayExceptionReset(self):
     if DisplayException:
         instance = trac26.eCTwSC(3)
         instance.reset()
         instance.validateBinding()
示例#22
0
 def testDisplayException(self):
     if DisplayException:
         instance = trac26.eCTwSC()
示例#23
0
 def testDisplay (self):
     if DisplayException:
         instance = trac26.eInts()
         instance.append(trac26.eCTwSC(2))
示例#24
0
 def testDisplay(self):
     if DisplayException:
         instance = trac26.eCTwSCSequence()
         instance.append(trac26.eCTwSC(2))
         instance.append('noise')
示例#25
0
 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))
示例#26
0
 def testDisplay (self):
     instance = trac26.eCTwSC(1)
     if DisplayException:
         instance.append(2)
示例#27
0
 def testSchemaSupport (self):
     instance = trac26.eEmpty()
     instance = trac26.eCTwSC(4)
示例#28
0
 def testDisplayException (self):
     if DisplayException:
         trac26.eCTwSC(4).toxml = 1
示例#29
0
 def testSchemaSupport(self):
     instance = trac26.eEmpty()
     instance = trac26.eCTwSC(4)
示例#30
0
 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))
示例#31
0
 def testDisplay(self):
     if DisplayException:
         instance = trac26.eInts()
         instance.append(trac26.eCTwSC(2))
示例#32
0
 def testDisplayException (self):
     if DisplayException:
         instance = trac26.eCTwSC()
示例#33
0
 def testDisplay(self):
     instance = trac26.eCTwSC(1)
     if DisplayException:
         instance.append(2)
示例#34
0
 def testDisplayException(self):
     if DisplayException:
         trac26.eCTwSC(4).toxml = 1
示例#35
0
 def testDirect (self):
     instance = None
     with self.assertRaises(pyxb.SimpleContentAbsentError) as cm:
         instance = trac26.eCTwSC()
     e = cm.exception
     self.assertTrue(instance is None)
示例#36
0
 def testDirect(self):
     instance = None
     with self.assertRaises(pyxb.SimpleContentAbsentError) as cm:
         instance = trac26.eCTwSC()
     e = cm.exception
     self.assertTrue(instance is None)
示例#37
0
 def testDisplayExceptionXsdConstraints (self):
     if DisplayException:
         instance = trac26.eCTwSC(3)
         instance.reset()
         instance.xsdConstraintsOK()
示例#38
0
 def testDisplay (self):
     if DisplayException:
         instance = trac26.eCTwSCSequence()
         instance.append(trac26.eCTwSC(2))
         instance.append('noise')
示例#39
0
 def testSchemaSupport (self):
     instance = trac26.eCTwSC(4)
     instance.nottoxml = 1
示例#40
0
 def testSchemaSupport(self):
     instance = trac26.eCTwSC(4)
     instance.nottoxml = 1