Example #1
0
    def test_xml_has_value(self):
        doc = xml()
        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),
            '<xml at 0x\w+ /a/b/x:c/d/e/q:f/x:g/h/q:j `{}`>'.format(value))
Example #2
0
    def test_xml_no_value(self):
        doc = xml()
        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), '<xml at 0x\w+ /a/b/x:c/d/e/q:f/x:g/h/q:j>')