def testStandard (self): def_map = xsd.categoryMap('typeDefinition') binding_map = xsd.categoryMap('typeBinding') int_en = pyxb.namespace.ExpandedName(xsd, 'int') self.assertEqual(xsd_module.int, binding_map['int']) self.assertEqual(xsd_module.int.SimpleTypeDefinition(), def_map['int']) self.assertEqual(int_en.typeDefinition(), def_map['int']) self.assertEqual(xsd_module.int, int_en.typeBinding())
def testXSDCategories (self): # Need type and element bindings, along with all the component ones self.assertTrue('elementBinding' in xsd.categories()) self.assertTrue('typeBinding' in xsd.categories())
# -*- coding: utf-8 -*- import logging if __name__ == '__main__': logging.basicConfig() _log = logging.getLogger(__name__) import unittest import pyxb from pyxb.namespace import ExpandedName import xml.dom from pyxb.namespace import XMLSchema as xsd xsd.validateComponentModel() import pyxb.binding.datatypes as xsd_module class TestExpandedName (unittest.TestCase): def testEquivalence (self): an1 = ExpandedName(None, 'string') en1 = ExpandedName(xsd, 'string') en2 = ExpandedName(xsd, 'string') en3 = ExpandedName(xsd, 'notString') self.assertEqual(en1, en2) self.assertEqual(en1, ( en1.namespace(), en1.localName() )) self.assertTrue(en1 == en2) self.assertFalse(en1 == en3) self.assertTrue(en1 != en3) self.assertTrue(an1 == an1.localName()) self.assertFalse(an1 == en3.localName()) self.assertTrue(an1 != en3.localName()) self.assertFalse(an1 != an1.localName()) def testRichComparisons (self): s1 = 'alpha'