def testContentSet(self): instance = trac26.eNilOneInt(_nil=True) with self.assertRaises(pyxb.ContentInNilInstanceError) as cm: instance.eInt = 1 e = cm.exception self.assertTrue(e.location is None) self.assertEqual(e.instance, instance)
def testContentSet (self): instance = trac26.eNilOneInt(_nil=True) with self.assertRaises(pyxb.ContentInNilInstanceError) as cm: instance.eInt = 1 e = cm.exception self.assertTrue(e.location is None) self.assertEqual(e.instance, instance)
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())
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())