linpershey/process_mining
0
1import os2import unittest3 4from pm4py.statistics.traces.generic.pandas import case_statistics as pd_case_statistics5from pm4py.objects.log.importer.xes import importer as xes_importer6from pm4py.statistics.traces.generic.log import case_statistics as log_case_statistics7from pm4py.statistics.attributes.log import get as log_attributes_filter8from pm4py.statistics.attributes.pandas import get as pd_attributes_filter9from pm4py.util import constants, pandas_utils10from pm4py.objects.log.util import dataframe_utils11 12 13class GraphsForming(unittest.TestCase):14 def test_dfCasedurationPlotSemilogx(self):15 # to avoid static method warnings in tests,16 # that by construction of the unittest package have to be expressed in such way17 self.dummy_variable = "dummy_value"18 19 df = pandas_utils.read_csv(os.path.join("input_data", "receipt.csv"))20 df = dataframe_utils.convert_timestamp_columns_in_df(df, timest_format=constants.DEFAULT_TIMESTAMP_PARSE_FORMAT)21 x, y = pd_case_statistics.get_kde_caseduration(df)22 json = pd_case_statistics.get_kde_caseduration_json(df)23 del json24 25 def test_logCaseDurationPlotSemiLogx(self):26 # to avoid static method warnings in tests,27 # that by construction of the unittest package have to be expressed in such way28 self.dummy_variable = "dummy_value"29 30 log = xes_importer.apply(os.path.join("input_data", "receipt.xes"))31 x, y = log_case_statistics.get_kde_caseduration(log)32 json = log_case_statistics.get_kde_caseduration_json(log)33 del json34 35 def test_dfNumericAttribute(self):36 # to avoid static method warnings in tests,37 # that by construction of the unittest package have to be expressed in such way38 self.dummy_variable = "dummy_value"39 40 df = pandas_utils.read_csv(os.path.join("input_data", "roadtraffic100traces.csv"))41 df = dataframe_utils.convert_timestamp_columns_in_df(df, timest_format=constants.DEFAULT_TIMESTAMP_PARSE_FORMAT)42 43 x, y = pd_attributes_filter.get_kde_numeric_attribute(df, "amount")44 json = pd_attributes_filter.get_kde_numeric_attribute_json(df, "amount")45 del json46 47 def test_logNumericAttribute(self):48 # to avoid static method warnings in tests,49 # that by construction of the unittest package have to be expressed in such way50 self.dummy_variable = "dummy_value"51 52 log = xes_importer.apply(os.path.join("input_data", "roadtraffic100traces.xes"))53 x, y = log_attributes_filter.get_kde_numeric_attribute(log, "amount")54 json = log_attributes_filter.get_kde_numeric_attribute_json(log, "amount")55 del json56 57 58if __name__ == "__main__":59 unittest.main()60 