1# -*- coding: utf-8 -*-
2import logging
3if __name__ == '__main__':
4    logging.basicConfig()
5_log = logging.getLogger(__name__)
6# Declare xml namespace
7import pyxb.binding.generate
8import pyxb.utils.domutils
9from xml.dom import Node
10
11import os.path
12
13xsd='''<?xml version="1.0" encoding="UTF-8"?>
14<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xml="http://www.w3.org/XML/1998/namespace">
15  <xs:complexType name="structure">
16    <xs:attributeGroup ref="xml:specialAttrs"/>
17  </xs:complexType>
18  <xs:element name="instance" type="structure"/>
19</xs:schema>'''
20
21code = pyxb.binding.generate.GeneratePython(schema_text=xsd)
22#open('code.py', 'w').write(code)
23
24rv = compile(code, 'test', 'exec')
25eval(rv)
26
27from pyxb.exceptions_ import *
28
29import unittest
30
31class TestTrac0023 (unittest.TestCase):
32    def testBasic (self):
33        self.assertEqual(4, len(structure._AttributeMap))
34        self.assertEqual(pyxb.binding.xml_.STD_ANON_lang, structure._AttributeMap[pyxb.namespace.XML.createExpandedName('lang')].dataType())
35        self.assertEqual(pyxb.binding.xml_.STD_ANON_space, structure._AttributeMap[pyxb.namespace.XML.createExpandedName('space')].dataType())
36        self.assertEqual(pyxb.binding.datatypes.anyURI, structure._AttributeMap[pyxb.namespace.XML.createExpandedName('base')].dataType())
37        self.assertEqual(pyxb.binding.datatypes.ID, structure._AttributeMap[pyxb.namespace.XML.createExpandedName('id')].dataType())
38
39if __name__ == '__main__':
40    unittest.main()
41