Ejemplo n.º 1
0
    def test_successors_loop_len_1(self):
        d = {("a", "b", "c"): 2, ("a", "a", "f"): 1}
        s = {("a", "b"): 2, ("b", "c"): 2, ("a", "f"): 1, ("a", "a"): 1}
        tl = TraceLog(d)
        s_tl = tl.successors(distance=1)

        for k, v in s.items():
            assert k in s_tl
            assert s_tl[k] == v

        for k, v in s_tl.items():
            assert k in s
            assert s[k] == v
Ejemplo n.º 2
0
    def test_successors(self):
        d = {("a", "b", "c"): 2, ("a", "f"): 1}
        s = {("a", "b"): 2, ("b", "c"): 2, ("a", "f"): 1}
        tl = TraceLog(d)
        s_tl = tl.successors()

        for k, v in s.items():
            assert k in s_tl
            assert s_tl[k] == v

        for k, v in s_tl.items():
            assert k in s
            assert s[k] == v
Ejemplo n.º 3
0
 def test_successors_exception_no_positive_integer(self):
     d = {("a", "b", "c"): 2, ("a", "a", "f"): 1}
     tl = TraceLog(d)
     with pytest.raises(ValueError):
         tl.successors(distance=-3.3)