Example #1
0
 def testContentAppend(self):
     instance = trac26.eNilInts(_nil=True)
     self.assertTrue(instance._isNil())
     with self.assertRaises(pyxb.ContentInNilInstanceError) as cm:
         type(instance)._UseForTag('eInt').append(instance, 1)
     e = cm.exception
     self.assertTrue(e.location is None)
     self.assertEqual(e.instance, instance)
Example #2
0
 def testContentAppend (self):
     instance = trac26.eNilInts(_nil=True)
     self.assertTrue(instance._isNil())
     with self.assertRaises(pyxb.ContentInNilInstanceError) as cm:
         type(instance)._UseForTag('eInt').append(instance, 1)
     e = cm.exception
     self.assertTrue(e.location is None)
     self.assertEqual(e.instance, instance)
Example #3
0
 def testValidate(self):
     instance = trac26.eNilInts(1, 2, 3)
     self.assertTrue(instance.validateBinding())
     instance._setIsNil(True)
     self.assertTrue(instance.validateBinding())
     # Not a valid way to do things, but only way to test this raise
     instance.content().append(1)
     with self.assertRaises(pyxb.ContentInNilInstanceError) as cm:
         instance.validateBinding()
     e = cm.exception
     self.assertTrue(e.location is None)
     self.assertEqual(e.content, [1])
Example #4
0
 def testValidate (self):
     instance = trac26.eNilInts(1, 2, 3)
     self.assertTrue(instance.validateBinding())
     instance._setIsNil(True)
     self.assertTrue(instance.validateBinding())
     # Not a valid way to do things, but only way to test this raise
     instance.content().append(1)
     with self.assertRaises(pyxb.ContentInNilInstanceError) as cm:
         instance.validateBinding()
     e = cm.exception
     self.assertTrue(e.location is None)
     self.assertEqual(e.content, [1])
Example #5
0
 def testSchemaSupport (self):
     instance = trac26.eNilCTwSC(4)
     self.assertEqual(instance.value(), 4)
     self.assertTrue(instance.validateBinding())
     instance = trac26.eNilCTwSC(_nil=True)
     self.assertTrue(instance.value() is None)
     self.assertTrue(instance.validateBinding())
     instance = trac26.CreateFromDocument(self.Good_xmlt)
     self.assertEqual(self.Good_xmld, instance.toxml('utf-8', root_only=True))
     instance = trac26.eNilInt(4)
     self.assertEqual(4, instance)
     instance = trac26.eNilInt(_nil=True)
     self.assertTrue(instance.validateBinding())
     instance = trac26.eNilCTwSC(3)
     instance.reset()
     instance.append(4)
     self.assertTrue(instance.validateBinding())
     instance = trac26.eNilOneInt()
     instance.eInt = 5
     self.assertTrue(instance.validateBinding())
     instance = trac26.eNilInts()
     instance.eInt.append(1)
     self.assertTrue(instance.validateBinding())
Example #6
0
 def testSchemaSupport(self):
     instance = trac26.eNilCTwSC(4)
     self.assertEqual(instance.value(), 4)
     self.assertTrue(instance.validateBinding())
     instance = trac26.eNilCTwSC(_nil=True)
     self.assertTrue(instance.value() is None)
     self.assertTrue(instance.validateBinding())
     instance = trac26.CreateFromDocument(self.Good_xmlt)
     self.assertEqual(self.Good_xmld, instance.toxml('utf-8',
                                                     root_only=True))
     instance = trac26.eNilInt(4)
     self.assertEqual(4, instance)
     instance = trac26.eNilInt(_nil=True)
     self.assertTrue(instance.validateBinding())
     instance = trac26.eNilCTwSC(3)
     instance.reset()
     instance.append(4)
     self.assertTrue(instance.validateBinding())
     instance = trac26.eNilOneInt()
     instance.eInt = 5
     self.assertTrue(instance.validateBinding())
     instance = trac26.eNilInts()
     instance.eInt.append(1)
     self.assertTrue(instance.validateBinding())