def test_elem_has_value(self): doc = Elem() doc.ns_map = {'x':'example.com', 'q':'example.com/2'} value = rand_string() doc.a.b.x_c.d.e.q_f.x_g.h.q_j = value self.assertRegexpMatches( repr(doc.a.b.x_c.d.e.q_f.x_g.h.q_j), '<Elem at 0x\w+ a.b.x:c.d.e.q:f.x:g.h.q:j `{}`>'.format(value))
def test_elem_no_value(self): doc = Elem() doc.ns_map = {'x':'example.com', 'q':'example.com/2'} doc.a.b.x_c.d.e.q_f.x_g.h.q_j # No value self.assertRegexpMatches(repr(doc.a.b.x_c.d.e.q_f.x_g.h.q_j), '<Elem at 0x\w+ a.b.x:c.d.e.q:f.x:g.h.q:j>')