Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 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())
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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())
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 19
0
 def testDisplayExceptionReset (self):
     if DisplayException:
         instance = trac26.eCTwSC(3)
         instance.reset()
         instance.validateBinding()
Exemplo n.º 20
0
 def testDisplayExceptionXsdConstraints(self):
     if DisplayException:
         instance = trac26.eCTwSC(3)
         instance.reset()
         instance.xsdConstraintsOK()
Exemplo n.º 21
0
 def testDisplayExceptionReset(self):
     if DisplayException:
         instance = trac26.eCTwSC(3)
         instance.reset()
         instance.validateBinding()
Exemplo n.º 22
0
 def testDisplayException(self):
     if DisplayException:
         instance = trac26.eCTwSC()
Exemplo n.º 23
0
 def testDisplay (self):
     if DisplayException:
         instance = trac26.eInts()
         instance.append(trac26.eCTwSC(2))
Exemplo n.º 24
0
 def testDisplay(self):
     if DisplayException:
         instance = trac26.eCTwSCSequence()
         instance.append(trac26.eCTwSC(2))
         instance.append('noise')
Exemplo n.º 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))
Exemplo n.º 26
0
 def testDisplay (self):
     instance = trac26.eCTwSC(1)
     if DisplayException:
         instance.append(2)
Exemplo n.º 27
0
 def testSchemaSupport (self):
     instance = trac26.eEmpty()
     instance = trac26.eCTwSC(4)
Exemplo n.º 28
0
 def testDisplayException (self):
     if DisplayException:
         trac26.eCTwSC(4).toxml = 1
Exemplo n.º 29
0
 def testSchemaSupport(self):
     instance = trac26.eEmpty()
     instance = trac26.eCTwSC(4)
Exemplo n.º 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))
Exemplo n.º 31
0
 def testDisplay(self):
     if DisplayException:
         instance = trac26.eInts()
         instance.append(trac26.eCTwSC(2))
Exemplo n.º 32
0
 def testDisplayException (self):
     if DisplayException:
         instance = trac26.eCTwSC()
Exemplo n.º 33
0
 def testDisplay(self):
     instance = trac26.eCTwSC(1)
     if DisplayException:
         instance.append(2)
Exemplo n.º 34
0
 def testDisplayException(self):
     if DisplayException:
         trac26.eCTwSC(4).toxml = 1
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 37
0
 def testDisplayExceptionXsdConstraints (self):
     if DisplayException:
         instance = trac26.eCTwSC(3)
         instance.reset()
         instance.xsdConstraintsOK()
Exemplo n.º 38
0
 def testDisplay (self):
     if DisplayException:
         instance = trac26.eCTwSCSequence()
         instance.append(trac26.eCTwSC(2))
         instance.append('noise')
Exemplo n.º 39
0
 def testSchemaSupport (self):
     instance = trac26.eCTwSC(4)
     instance.nottoxml = 1
Exemplo n.º 40
0
 def testSchemaSupport(self):
     instance = trac26.eCTwSC(4)
     instance.nottoxml = 1