예제 #1
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')
예제 #2
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')
예제 #3
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)
예제 #4
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)
예제 #5
0
 def testDisplay(self):
     if DisplayException:
         instance = trac26.eCTwSCSequence()
         instance.append(trac26.eCTwSC(2))
         instance.append('noise')
예제 #6
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))
예제 #7
0
 def testDisplay (self):
     if DisplayException:
         instance = trac26.eCTwSCSequence()
         instance.append(trac26.eCTwSC(2))
         instance.append('noise')
예제 #8
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))