Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: calculate_diff_on_dicts to Support Integer Values for ARP Table ttl #153

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion panos_upgrade_assurance/snapshot_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def calculate_diff_on_dicts(
item_changed = False
for key in keys_to_check:
if right_side_to_compare[key] != left_side_to_compare[key]:
if isinstance(left_side_to_compare[key], str):
if isinstance(left_side_to_compare[key], (str, int)):
result["changed"]["changed_raw"][key] = dict(
left_snap=left_side_to_compare[key],
right_snap=right_side_to_compare[key],
Expand Down
2 changes: 1 addition & 1 deletion tests/test_snapshot_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test_calculate_diff_on_dicts_empty_dicts(self):
# NOTE: Non-dictionary input is not handled in the code and not tested
# if non supported input is passed it raises AttributeError since it doesnt have keys() method
def test_calculate_diff_on_dicts_invalid_input(self):
left_snapshot = {"key1": 123, "key2": "value2"}
left_snapshot = {"key1": 1.23, "key2": "value2"}
right_snapshot = {"key1": {"nested_key1": "value1"}, "key2": "value2"}

with pytest.raises(WrongDataTypeException) as exception_msg:
Expand Down
Loading