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

Added test to ensure order attribute for ordered column profiler functions correctly after deserialization #868

Merged
Merged
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
21 changes: 19 additions & 2 deletions dataprofiler/tests/profilers/test_order_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def test_json_decode_after_update(self):
fake_profile_name = "Fake profile name"

# Build expected orderColumn
df_order = pd.Series(["za", "z", "c", "a"])
df_order = pd.Series(["za", "z", "c", "c"])
expected_profile = OrderColumn(fake_profile_name)

with utils.mock_timeit():
Expand All @@ -440,15 +440,32 @@ def test_json_decode_after_update(self):

utils.assert_profiles_equal(deserialized, expected_profile)

# Adding data to update that is in descending order
# (consistent with previous data)
df_order = pd.Series(
[
"c", # add existing
"zza", # add new
"a", # add new
]
)

# validating update after deserialization
deserialized.update(df_order)

assert deserialized.sample_size == 6
assert deserialized._last_value == "a"
assert deserialized.order == expected_profile.order

# Adding data to update that is in random order
# (not consistent with previous data)
df_order = pd.Series(
[
"c", # add existing
"zza", # add new
]
)
deserialized.update(df_order)

assert deserialized.sample_size == 8
assert deserialized._last_value == "zza"
assert deserialized.order == "random"