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