def test_follows_distance_2(self): d = {("a", "b", "c"): 2, ("a", "f"): 1} s = {("a", "c"): 2} tl = TraceLog(d) s_tl = tl.follows(distance=2) 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
def test_follows_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.follows(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
def test_follows_exception_no_positive_integer(self): d = {("a", "b", "c"): 2, ("a", "a", "f"): 1} tl = TraceLog(d) with pytest.raises(ValueError): tl.follows(distance=-3.3)