コード例 #1
0
def test_query_object(data_file, object_type, object_identifier, expected_value):
    knowledge_base = InMemoryKnowledgeBase(data_file)

    actual_value = knowledge_base.get_object(
        object_type=object_type, object_identifier=object_identifier
    )

    assert expected_value == actual_value
コード例 #2
0
def test_get_representation_function_of_object(
    data_file, object_type, set_repr_function, expected_repr_function
):
    knowledge_base = InMemoryKnowledgeBase(data_file)
    if set_repr_function:
        knowledge_base.set_representation_function_of_object(
            object_type, set_repr_function
        )

    actual_repr_function = knowledge_base.get_representation_function_of_object(
        object_type=object_type
    )

    dummy_object = knowledge_base.get_object(object_type, 1)

    assert expected_repr_function(dummy_object) == actual_repr_function(dummy_object)