49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
from template_code_location.dataframe_level_anonymisation.config_models.hierarchies import (
|
|
simpl_age,
|
|
simpl_age2,
|
|
simpl_gender,
|
|
get_all_hierarchies,
|
|
)
|
|
|
|
|
|
def test_simpl_age_structure():
|
|
assert isinstance(simpl_age, dict)
|
|
assert 0 in simpl_age
|
|
assert isinstance(simpl_age[0], list)
|
|
# verify first level contains 100 ages
|
|
assert len(simpl_age[0]) == 100
|
|
assert simpl_age[0][0] == 0
|
|
assert simpl_age[0][-1] == 99
|
|
|
|
|
|
def test_simpl_age2_structure():
|
|
assert isinstance(simpl_age2, dict)
|
|
assert 0 in simpl_age2
|
|
assert 1 in simpl_age2
|
|
assert isinstance(simpl_age2[0], list)
|
|
assert isinstance(simpl_age2[1], list)
|
|
|
|
|
|
def test_simpl_gender_structure():
|
|
assert isinstance(simpl_gender, dict)
|
|
assert 0 in simpl_gender
|
|
assert 1 in simpl_gender
|
|
assert simpl_gender[0] == ["M", "F", "O"]
|
|
assert simpl_gender[1] == ["*", "*", "*"]
|
|
|
|
|
|
def test_get_all_hierarchies():
|
|
hier = get_all_hierarchies()
|
|
|
|
# the function should return dicts only
|
|
assert isinstance(hier, dict)
|
|
|
|
# ensure expected dicts are included
|
|
assert "simpl_age" in hier
|
|
assert "simpl_age2" in hier
|
|
assert "simpl_gender" in hier
|
|
|
|
# ensure the values returned are references to the actual dicts
|
|
assert hier["simpl_age"] is simpl_age
|
|
assert hier["simpl_gender"] is simpl_gender
|