1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
# -*- coding: utf-8 -*-
from __future__ import print_function
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
from pyxb.exceptions_ import *
import unittest
import pyxb.binding.datatypes as xsd
class Test_QName (unittest.TestCase):
def testValid (self):
valid = [ 'schema', 'xs:something', 'with.dots' ]
for f in valid:
self.assertEqual(f, xsd.QName(f))
def testInvalid (self):
invalid = [ '-NonName', '-also:-not', 'and:-not', 'too:many:colons', ' whitespace ' ]
for f in invalid:
try:
xsd.QName(f)
print('Unexpected pass with %s' % (f,))
except:
pass
self.assertRaises(SimpleTypeValueError, xsd.QName, f)
if __name__ == '__main__':
unittest.main()
|