def test_initialize_case_metrics(self, process: CDESF, cases_list: "list[Case]"): process.initialize_case_metrics() assert process.cases == [] process.cases = cases_list case_3 = process.cases[0] assert case_3.distances.get("graph") is None assert case_3.distances.get("graph") is None case_2 = process.cases[1] assert case_2.distances.get("graph") is None assert case_2.distances.get("graph") is None case_1 = process.cases[2] assert case_1.distances.get("graph") is None assert case_1.distances.get("graph") is None process.initialize_case_metrics() case_3 = process.cases[0] assert case_3.distances["graph"] == 0 assert case_3.distances["time"] == 0 case_2 = process.cases[1] assert case_2.distances["graph"] == 0 assert case_2.distances["time"] == 0 case_1 = process.cases[2] assert case_1.distances["graph"] == 0 assert case_1.distances["time"] == 0 process.cases = cases_list process.process_model_graph = initialize_graph(process.cases) process.initialize_case_metrics() case_3 = process.cases[0] # Verify that the distances are applied. distances_for_case_3 = calculate_case_distances( process.process_model_graph, case_3) assert case_3.distances["graph"] == distances_for_case_3["graph"] assert case_3.distances["time"] == distances_for_case_3["time"] distances_for_case_2 = calculate_case_distances( process.process_model_graph, case_2) case_2 = process.cases[1] assert case_2.distances["graph"] == distances_for_case_2["graph"] assert case_2.distances["time"] == distances_for_case_2["time"] distances_for_case_1 = calculate_case_distances( process.process_model_graph, case_1) case_1 = process.cases[2] assert case_1.distances["graph"] == distances_for_case_1["graph"] assert case_1.distances["time"] == distances_for_case_1["time"]
def test_set_case(self, process: CDESF): assert process.check_point_cases == 0 assert process.cases == [] process.set_case( "5", { "concept:name": "activityA", "time:timestamp": datetime(2015, 5, 10, 8, 00, 00), }, ) assert process.check_point_cases == 1 assert process.cases case_test = process.cases[0] assert case_test.id == "5" assert case_test.events[0].get("concept:name") == "activityA" assert case_test.events[0].get("time:timestamp") == datetime( 2015, 5, 10, 8, 00, 00) case1 = Case("1") case2 = Case("2") case3 = Case("3") case4 = Case("4") process.check_point_cases = 0 process.cases = [case1, case2, case3, case4] process.set_case( "3", { "concept:name": "activityA", "time:timestamp": datetime(2015, 5, 10, 8, 00, 00), }, ) assert process.check_point_cases == 0 assert process.cases case_test = process.cases[0] assert case_test.id == "3" assert case_test.events[0].get("concept:name") == "activityA" assert case_test.events[0].get("time:timestamp") == datetime( 2015, 5, 10, 8, 00, 00)