Exemple #1
0
 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())
Exemple #2
0
 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())
Exemple #3
0
 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())
Exemple #4
0
# -*- 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'
Exemple #5
0
 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())
Exemple #6
0
# -*- 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'