Skip to content

Commit

Permalink
Handle all diff categories
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Gu <[email protected]>
  • Loading branch information
tylergu committed Feb 26, 2024
1 parent a189eb7 commit 20bd266
Showing 1 changed file with 10 additions and 33 deletions.
43 changes: 10 additions & 33 deletions acto/post_process/post_diff_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,39 +961,16 @@ def __get_diff_paths(self, diff_test_result: DiffTestResult) -> list[str]:
)

if diff_result is not None:
for diff_category, diff in diff_result.diff.items():
if diff_category == "dictionary_item_removed":
removed_items: list[DiffLevel] = diff
for removed_item in removed_items:
if first_step:
initial_regex.add(
re.escape(removed_item.path())
)
else:
indeterministic_regex.add(removed_item.path())
elif diff_category == "dictionary_item_added":
added_items: list[DiffLevel] = diff
for added_item in added_items:
if first_step:
initial_regex.add(re.escape(added_item.path()))
else:
indeterministic_regex.add(added_item.path())
elif diff_category == "values_changed":
changed_items: list[DiffLevel] = diff
for changed_item in changed_items:
if first_step:
initial_regex.add(
re.escape(changed_item.path())
)
else:
indeterministic_regex.add(changed_item.path())
elif diff_category == "type_changes":
type_changes: list[DiffLevel] = diff
for type_change in type_changes:
if first_step:
initial_regex.add(re.escape(type_change.path()))
else:
indeterministic_regex.add(type_change.path())
for diff in diff_result.diff.values():
if not isinstance(diff, list):
continue
for diff_item in diff:
if not isinstance(diff_item, DiffLevel):
continue
if first_step:
initial_regex.add(re.escape(diff_item.path()))
else:
indeterministic_regex.add(diff_item.path())
first_step = False

# Handle the case where the name is not deterministic
Expand Down

0 comments on commit 20bd266

Please sign in to comment.