Skip to content

CI: check_freq=False #34050

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

Merged
merged 11 commits into from
May 9, 2020
9 changes: 8 additions & 1 deletion pandas/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,7 @@ def assert_series_equal(
check_datetimelike_compat=False,
check_categorical=True,
check_category_order=True,
check_freq=True,
obj="Series",
):
"""
Expand Down Expand Up @@ -1140,6 +1141,8 @@ def assert_series_equal(
Whether to compare internal Categorical exactly.
check_category_order : bool, default True
Whether to compare category order of internal Categoricals.
check_freq : bool, default True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to below versionadded:: 1.0.2 for check_category_order and add versionadded:: 1.1.0

Whether to check the `freq` attribute on a DatetimeIndex or TimedeltaIndex.

.. versionadded:: 1.0.2
obj : str, default 'Series'
Expand Down Expand Up @@ -1171,7 +1174,7 @@ def assert_series_equal(
check_categorical=check_categorical,
obj=f"{obj}.index",
)
if isinstance(left.index, (pd.DatetimeIndex, pd.TimedeltaIndex)):
if check_freq and isinstance(left.index, (pd.DatetimeIndex, pd.TimedeltaIndex)):
lidx = left.index
ridx = right.index
assert lidx.freq == ridx.freq, (lidx.freq, ridx.freq)
Expand Down Expand Up @@ -1274,6 +1277,7 @@ def assert_frame_equal(
check_datetimelike_compat=False,
check_categorical=True,
check_like=False,
check_freq=True,
obj="DataFrame",
):
"""
Expand Down Expand Up @@ -1327,6 +1331,8 @@ def assert_frame_equal(
If True, ignore the order of index & columns.
Note: index labels must match their respective rows
(same as in columns) - same labels must be with the same data.
check_freq : bool, default True
Whether to check the `freq` attribute on a DatetimeIndex or TimedeltaIndex.
Comment on lines +1336 to +1337
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add versionadded:: 1.1.0

obj : str, default 'DataFrame'
Specify object name being compared, internally used to show appropriate
assertion message.
Expand Down Expand Up @@ -1433,6 +1439,7 @@ def assert_frame_equal(
check_names=check_names,
check_datetimelike_compat=check_datetimelike_compat,
check_categorical=check_categorical,
check_freq=check_freq,
obj=f'{obj}.iloc[:, {i}] (column name="{col}")',
)

Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/io/pytables/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,10 @@ def check_col(key, name, size):

result = store.select("df_dc", ["B > 0", "C > 0", "string == foo"])
expected = df_dc[(df_dc.B > 0) & (df_dc.C > 0) & (df_dc.string == "foo")]
tm.assert_frame_equal(result, expected, check_index_type=False)
tm.assert_frame_equal(
result, expected, check_index_type=False, check_freq=False
)
# FIXME: 2020-05-07 freq check randomly fails in the CI

with ensure_clean_store(setup_path) as store:
# doc example part 2
Expand Down