示例#1
0
    def show_rule_classification(self):
        print_info("Rules Classification")

        data_bundle = get_rule_classification_data(
            self.quark_analysis.call_graph_analysis_list, MAX_SEARCH_LAYER)

        output_parent_function_table(data_bundle)
        output_parent_function_json(data_bundle)
        output_parent_function_graph(data_bundle)
示例#2
0
def test_get_rule_classification_data_with_duplicate_crime(
    duplicate_crime_list,
):
    expected_parent = duplicate_crime_list[0]["parent"]

    report_dict, reference_dict = get_rule_classification_data(
        duplicate_crime_list, MAX_SEARCH_LAYER
    )

    assert set(report_dict.keys()) == {expected_parent}
    assert report_dict[expected_parent] == {"The Crime"}
    assert set(reference_dict.keys()) == {expected_parent}
    assert reference_dict[expected_parent] == set()
示例#3
0
def test_get_rule_classification_data_with_referenced_crime(
    referenced_crime_list,
):
    expected_parent_1 = referenced_crime_list[0]["parent"]
    expected_parent_2 = referenced_crime_list[1]["parent"]

    report_dict, reference_dict = get_rule_classification_data(
        referenced_crime_list, MAX_SEARCH_LAYER
    )

    assert report_dict.keys() == {expected_parent_1, expected_parent_2}
    assert report_dict[expected_parent_1] == {"The Crime"}
    assert report_dict[expected_parent_2] == {"Another Crime"}
    assert reference_dict.keys() == {expected_parent_1, expected_parent_2}
    assert reference_dict[expected_parent_1] == set()
    assert reference_dict[expected_parent_2] == {expected_parent_1}