Skip to content

Commit

Permalink
test: Check _filter_target_dict_with_list selects & filters correct t…
Browse files Browse the repository at this point in the history
…arget dict
  • Loading branch information
r-leyshon committed Oct 17, 2023
1 parent 845023f commit 9d7a8c0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/osm/test_validate_osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,19 @@ def test_filter_target_dict_with_list_raises(self):
search_key="some_dict",
accepted_keys=["some_dict"],
)

def test__filter_target_dict_with_list_returns(self):
"""Assert that target dict is filtered."""
target_dicts = {
"choose_me": {1: "keep", 2: "keep", 3: "keep", 4: "remove"},
"do_not_choose_me": {1: "should", 2: "not", 3: "appear"},
}
out = _filter_target_dict_with_list(
targets=target_dicts,
_list=[1, 2, 3],
search_key="choose_me",
accepted_keys=["choose_me", "do_not_choose_me"],
)
assert isinstance(out, dict)
assert list(out.keys()) == ["choose_me"]
assert "remove" not in out.values()

0 comments on commit 9d7a8c0

Please sign in to comment.