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