def test_make_append_tree(self): res = condition.make_append_tree("", "m=1", "old", "m1") expect_res = { "default": {"__value": "old"}, "m=1": {"__value": "m1"} } self.assertEqual(res, expect_res)
def test_make_append_tree5(self): res = condition.make_append_tree("m=1", "a!=2", "m1", "m1a2") expect_res = { "default": {"__value": "m1"}, "a=2": { "default": {"__value": "m1"}, "m=1": {"__value": "m1"} }, "m=1": {"__value": "m1a2"} } self.assertEqual(res, expect_res)
def test_make_append_tree3(self): res = condition.make_append_tree("m=1", "a=2&&b=3", "m1", "m1a2b3") expect_res = { "default": {"__value": "m1"}, "b=3": { "default": {"__value": "m1"}, "a=2": { "default": {"__value": "m1"}, "m=1": {"__value": "m1a2b3"} } } } self.assertEqual(res, expect_res)
def test_make_append_tree4(self): res = condition.make_append_tree("m=1", "a=2||b=3", "m1", "m1a2b3") expect_res = { 'default': {'__value': 'm1'}, 'b=3': { 'default': {'__value': 'm1'}, 'm=1': {'__value': 'm1a2b3'} }, 'a=2': { 'default': {'__value': 'm1'}, 'm=1': {'__value': 'm1a2b3'} } } self.assertEqual(res, expect_res)