Spaces:
Sleeping
Sleeping
File size: 1,872 Bytes
8097001 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import os
import unittest
from pm4py.algo.discovery.inductive import algorithm as inductive_miner
from pm4py.objects.log.importer.xes import importer as xes_importer
from pm4py.visualization.process_tree import visualizer as pt_vis
from pm4py.objects.process_tree import semantics as pt_semantics
from pm4py.objects.process_tree.utils import generic as pt_util
from tests.constants import INPUT_DATA_DIR
class InductiveMinerTreeTest(unittest.TestCase):
def test_tree_running_example_log_plain_based(self):
# to avoid static method warnings in tests,
# that by construction of the unittest package have to be expressed in such way
self.dummy_variable = "dummy_value"
log = xes_importer.apply(os.path.join(INPUT_DATA_DIR, "running-example.xes"))
tree = inductive_miner.apply(log, variant=inductive_miner.Variants.IM)
gviz = pt_vis.apply(tree)
del gviz
# test log generation
log = pt_semantics.generate_log(tree)
del log
def test_tree_receipt_log_plain_based(self):
# to avoid static method warnings in tests,
# that by construction of the unittest package have to be expressed in such way
self.dummy_variable = "dummy_value"
log = xes_importer.apply(os.path.join(INPUT_DATA_DIR, "receipt.xes"))
tree = inductive_miner.apply(log, variant=inductive_miner.Variants.IM)
gviz = pt_vis.apply(tree)
del gviz
del log
def test_tree_parsing(self):
# to avoid static method warnings in tests,
# that by construction of the unittest package have to be expressed in such way
self.dummy_variable = "dummy_value"
tree = pt_util.parse("->(X('a', 'b', tau), +('c', 'd'))")
# test log generation
log = pt_semantics.generate_log(tree)
if __name__ == "__main__":
unittest.main()
|