from dmpr import DMPR


class TestAuxMethods:
    @staticmethod
    def get_dict():
        return {
            1: {1: 1, 2: 2},
            2: {1: 1, 2: 2},
            3: {1: (1, 2)},
            4: "test",
            5: [2, 3]
        }

    def test_cmp_dict_simple(self):
        f = DMPR._cmp_dicts

        assert not f(None, None)
        assert f({}, {})
        assert f({1: 1}, {1: 1})
        assert not f({1: 1}, {2: 1})
        assert not f({1: 1}, {1: 2})

        assert f({1: {1: 1}}, {1: {1: 1}})
        assert not f({1: {1: 1}}, {1: {1: 2}})
        assert not f({1: {1: 1}}, {1: {2: 1}})

    def test_cmp_dict_deep(self):
        f = DMPR._cmp_dicts
        dict1 = self.get_dict()
        dict2 = self.get_dict()

        assert f(dict1, dict1)
        assert f(dict1, dict2)
        dict2[3][1] = (1, 2)
        assert f(dict1, dict2)
        dict2[3][1] = (2, 3)
        assert not f(dict1, dict2)

    def test_cmp_dict_deep_mutable(self):
        f = DMPR._cmp_dicts
        dict1 = self.get_dict()
        dict2 = self.get_dict()

        dict1[5] = [self.get_dict()]
        dict2[5] = [self.get_dict()]
        assert f(dict1, dict2)
        dict2[5][0][4] = "error"
        assert not f(dict1, dict2)
        dict2[5][0] = None
        assert not f(dict1, dict2)


def test_init_dmpr():
    dmpr = DMPR(log=True)

@@ -14,16 +14,22 @@
 ort DMPR
+, Path
 %0A%0A%0Aclass
@@ -1297,16 +1297,1792 @@
 ict2)%0A%0A%0A
+class TestPath:%0A    def get_path(self):%0A        return Path(path='A%3E%5B1%5D%3EB%3E%5B2%5D%3EC',%0A                    attributes=%7B%0A                        '1': %7B'loss': 10%7D,%0A                        '2': %7B'loss': 20%7D%0A                    %7D,%0A                    next_hop='B',%0A                    next_hop_interface='wlan0')%0A%0A    def test_correct_splitting(self):%0A        path = self.get_path()%0A        assert path.links == %5B'1', '2'%5D%0A        assert path.nodes == %5B'A', 'B', 'C'%5D%0A        assert path.next_hop_interface == 'wlan0'%0A%0A    def test_correct_appending(self):%0A        path = self.get_path()%0A        path.append('D', 'tetra', %7B'loss': 30%7D)%0A        assert path.next_hop_interface == 'tetra'%0A        assert path.links%5B0%5D == '3'%0A        assert path.attributes%5B'3'%5D%5B'loss'%5D == 30%0A%0A    def test_correct_applying_to_new(self):%0A        path = self.get_path()%0A        attributes = %7B%7D%0A        path.apply_attributes(attributes)%0A        assert %7B'loss': 20%7D in attributes.values()%0A        assert %7B'loss': 10%7D in attributes.values()%0A%0A    def test_correct_applying_to_others(self):%0A        path = self.get_path()%0A        attributes = %7B'1': %7B'loss': 30%7D%7D%0A        path.apply_attributes(attributes)%0A        assert %7B'loss': 20%7D in attributes.values()%0A        assert %7B'loss': 10%7D in attributes.values()%0A        assert attributes%5B'1'%5D == %7B'loss': 30%7D%0A%0A    def test_str(self):%0A        path = self.get_path()%0A        attributes = %7B%7D%0A        path.apply_attributes(attributes)%0A%0A        expected = %22A%3E%5B%7B%7D%5D%3EB%3E%5B%7B%7D%5D%3EC%22%0A        loss_10 = list(attributes.keys())%5B%0A            list(attributes.values()).index(%7B'loss': 10%7D)%5D%0A        loss_20 = list(attributes.keys())%5B%0A            list(attributes.values()).index(%7B'loss': 20%7D)%5D%0A        expected = expected.format(loss_10, loss_20)%0A%0A        assert str(path) == expected%0A%0A%0A
 def test

Add tests for the Path class