def test_always_after_xes(self): tl = TraceLog.from_xes(os.path.join(DATA, "L2.xes.gz")) target = { ("[>", "[]"), ("[>", "a"), ("[>", "b"), ("[>", "c"), ("[>", "d"), ("a", "b"), ("a", "c"), ("a", "d"), ("b", "d"), ("c", "d"), ("e", "b"), ("e", "c"), ("e", "d"), ("e", "f"), ("f", "b"), ("f", "c"), ("f", "d"), ("a", "[]"), ("b", "[]"), ("c", "[]"), ("d", "[]"), ("e", "[]"), ("f", "[]"), } tl_aug = tl.augment() R_aa = tl_aug.always_after() for pair in R_aa: assert pair in target for pair in target: assert pair in R_aa
def test_from_xes_gunzip(self): tl = TraceLog.from_xes(os.path.join(DATA, "L2.xes.gz")) target = { ("a", "b", "c", "d"): 3, ("a", "c", "b", "d"): 4, ("a", "b", "c", "e", "f", "b", "c", "d"): 2, ("a", "b", "c", "e", "f", "c", "b", "d"): 1, ("a", "c", "b", "e", "f", "b", "c", "d"): 2, ("a", "c", "b", "e", "f", "b", "c", "e", "f", "c", "b", "d"): 1, } for k, v in target.items(): assert k in tl assert tl[k] == v for k, v in tl.items(): assert k in target assert target[k] == v
def test_filter_traces(self): tl = TraceLog.from_xes(os.path.join(DATA, "L2.xes")) reqA = {'a', 'b', 'c'} forbA = {'e', 'f'} # target = { # ('a', 'b', 'c', 'e', 'f', 'b', 'c', 'd') : 2, # ('a', 'b', 'c', 'e', 'f', 'c', 'b', 'd') : 1, # ('a', 'c', 'b', 'e', 'f', 'b', 'c', 'd') : 2, # ('a', 'c', 'b', 'e', 'f', 'b', 'c', 'e', 'f', 'c', 'b', 'd') : 1 # } target = {('a', 'b', 'c', 'd'): 3, ('a', 'c', 'b', 'd'): 4} fa = tl.filter_traces(reqA, forbA) for k, v in fa.items(): assert k, v in target for k, v in tl.items(): assert k, v in fa
def process(dataset): tl = (TraceLog.from_xes(dataset)) tl_aug = tl.augment() session["dataset"] = tl_aug