Skip to content

Commit

Permalink
DBE-3085 removed data-check.py and added test_stop_at_top_level.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaosHour authored and ChaosHour committed Dec 17, 2024
1 parent c423027 commit 60d060f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
38 changes: 0 additions & 38 deletions data-check.py

This file was deleted.

38 changes: 38 additions & 0 deletions tests/test_stop_at_top_level.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import pytest
from data_diff.hashdiff_tables import HashDiffer

def test_stop_at_top_level():
differ = HashDiffer(stop_at_top_level=True)
# Test data with nested structures
data1 = [
{"top1": {"nested": "value1"},
"top2": {"nested": "value2"}}
]
data2 = [
{"top1": {"nested": "changed1"},
"top2": {"nested": "value2"}}
]

# Test without stop_at_top_level
differ.stop_at_top_level = False
full_diff = differ.diff_tables(data1, data2)
assert any("nested" in str(d) for d in full_diff)

# Test with stop_at_top_level
differ.stop_at_top_level = True
top_level_diff = differ.diff_tables(data1, data2)
assert any("top1" in str(d) for d in top_level_diff)
assert not any("nested" in str(d) for d in top_level_diff)

def test_stop_at_top_level_equal_nested():
differ = HashDiffer(stop_at_top_level=True)
# Test case where nested values are equal
data1 = [
{"top": {"nested": "same"}}
]
data2 = [
{"top": {"nested": "same"}}
]

diff = differ.diff_tables(data1, data2)
assert len(diff) == 0 # Should show no differences

0 comments on commit 60d060f

Please sign in to comment.