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 assert flattened data test #353

Merged
merged 1 commit into from
Feb 8, 2024
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
13 changes: 4 additions & 9 deletions src/timeseriesflattener/testing/utils_for_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,10 @@ def assert_flattened_data_as_expected(
elif expected_values:
output_df = flattened_ds.get_df()
value_cols = _get_value_cols_based_on_spec(output_df, output_spec)
output = output_df[value_cols].values.tolist()
expected = list(expected_values)

for i, expected_val in enumerate(expected):
# NaN != NaN, hence specific handling
if not isinstance(expected_val, (str, list)) and np.isnan(expected_val):
assert np.isnan(output[i])
else:
assert expected_val == output[i]
output = pd.Series(output_df[value_cols].values)
expected = pd.Series(expected_values)

assert_series_equal(output, expected, check_dtype=False)
else:
raise ValueError("Must provide an expected set of data")

Expand Down
Loading