def xtest_top_level_elems_no_ns(self): doc = Elem() doc.a = 'a' doc.b = 'b' expected = {'a':'a', 'b':'b'} out = doc.to_dict() self.assertDictEqual(expected, out)
def test_sub1(self): doc1 = Elem() doc2 = Elem() doc2.b = 123 doc1.a = doc2 expected = {'a': {'b': 123}} out = doc1.to_dict() self.assertDictEqual(expected, out)
def xtest_top_level_attrs_elems_attrs_no_ns(self): doc = Elem() doc.a = 'a' doc.b = 'b' doc._a = 'a2' doc._b = 'b2' expected = {'a':'a', 'b':'b', '#a':'a2', '#b':'b2'} out = doc.to_dict() self.assertDictEqual(expected, out)
def xtest_top_level_elems_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)