-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Primary key is now (id,entityTypeID) for context validators
adapted test data to reflect the chagned requirements
- Loading branch information
1 parent
1c44e46
commit 001dadd
Showing
7 changed files
with
103 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
import pytest | ||
from akm_tools.validation.data_context_validators import AllDataContextValidators | ||
|
||
|
||
def test_create_instance_dict(): | ||
""" | ||
Test case for the create_instance_dict method of the AllDataContextValidators class. | ||
This test checks if the create_instance_dict method correctly creates a dictionary | ||
that maps instance id's to a dictionary containing the count of instances with that ID | ||
and a list of the instances themselves. | ||
that maps instance composite keys (id, entityTypeID) to a dictionary containing the count | ||
of instances with that composite key and a list of the instances themselves. | ||
""" | ||
all_data = [{"id": "1a", "name": "test1"}, {"id": "2b", "name": "test2"}, {"id": "1a", "name": "test3"}] | ||
all_data = [ | ||
{"id": "1a", "entityTypeID": "type1", "name": "test1"}, | ||
{"id": "2b", "entityTypeID": "type2", "name": "test2"}, | ||
{"id": "1a", "entityTypeID": "type1", "name": "test3"} | ||
] | ||
instance_dict = AllDataContextValidators.create_instance_dict(all_data) | ||
expected_dict = { | ||
"1a": {"count": 2, "instances": [{"id": "1a", "name": "test1"}, {"id": "1a", "name": "test3"}]}, | ||
"2b": {"count": 1, "instances": [{"id": "2b", "name": "test2"}]}, | ||
("1a", "type1"): {"count": 2, "instances": [{"id": "1a", "entityTypeID": "type1", "name": "test1"}, {"id": "1a", "entityTypeID": "type1", "name": "test3"}]}, | ||
("2b", "type2"): {"count": 1, "instances": [{"id": "2b", "entityTypeID": "type2", "name": "test2"}]}, | ||
} | ||
assert instance_dict == expected_dict, "The instance dictionary was not created correctly." |
Oops, something went wrong.