示例#1
0
    def xtest_top_level_attrs_no_ns(self):
        doc = Elem()

        doc._a = 'a'
        doc._b = 'b'

        expected = {'#a':'a', '#b':'b'}
        out = doc.to_dict()
        self.assertDictEqual(expected, out)
示例#2
0
    def xtest_top_level_attrs_ns(self):
        doc = Elem()
        doc.ns_map += {'x':'example.com/1'}

        doc._a = 'a'
        doc._b = 'b'

        doc._x_a = 'a2'
        doc._x_b = 'b2'

        expected = {'#a':'a', '#b':'b', '#x_a':'a2', '#x_b':'b2'}
        out = doc.to_dict(include_ns=True)
        self.assertDictEqual(expected, out)
示例#3
0
    def xtest_top_level_attrs_elems_attrs_ns(self):

        doc = Elem()

        doc.a = 'a'
        doc.b = 'b'

        doc._a = 'a2'
        doc._b = 'b2'

        doc.x_a = 'a3'
        doc.x_b = 'b3'

        doc._x_a = 'a4'
        doc._x_b = 'b4'

        expected = {'a':'a', 'b':'b', '#a':'a2', '#b':'b2', 'x_a':'a3', 'x_b':'b3', '#x_a':'a4', '#x_b':'b4'}
        out = doc.to_dict()
        self.assertDictEqual(expected, out)