def testException (self): instance = trac26.eListCardCymru() with self.assertRaises(pyxb.SimpleListValueError) as cm: instance.append('pump') e = cm.exception self.assertEqual(e.type, trac26.tListCardCymru) self.assertEqual(e.value, 'pump') self.assertTrue(e.location is None) self.assertEqual(str(e), 'Member type tCardCymru of list type tListCardCymru cannot accept pump')
def testSchemaSupport (self): instance = trac26.eListCardCymru() instance.append('un') instance.append('dau') self.assertTrue(instance.validateBinding()) instance = trac26.CreateFromDocument(self.Good_xmlt) self.assertEqual(self.Good_xmld, instance.toxml('utf-8', root_only=True)) instance = trac26.eSimpleInstance() self.assertTrue(instance.validateBinding()) instance.eSimpleInstance = [ 'un', 'dau', 'tri' ] self.assertTrue(instance.validateBinding())
def testException(self): instance = trac26.eListCardCymru() with self.assertRaises(pyxb.SimpleListValueError) as cm: instance.append('pump') e = cm.exception self.assertEqual(e.type, trac26.tListCardCymru) self.assertEqual(e.value, 'pump') self.assertTrue(e.location is None) self.assertEqual( str(e), 'Member type tCardCymru of list type tListCardCymru cannot accept pump' )
def testSchemaSupport(self): instance = trac26.eListCardCymru() instance.append('un') instance.append('dau') self.assertTrue(instance.validateBinding()) instance = trac26.CreateFromDocument(self.Good_xmlt) self.assertEqual(self.Good_xmld, instance.toxml('utf-8', root_only=True)) instance = trac26.eSimpleInstance() self.assertTrue(instance.validateBinding()) instance.eSimpleInstance = ['un', 'dau', 'tri'] self.assertTrue(instance.validateBinding())