Skip to content

Commit 3ac34ff

Browse files
authored
CI: check_freq=False (#34050)
1 parent 5398eca commit 3ac34ff

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

pandas/_testing.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,7 @@ def assert_series_equal(
11041104
check_datetimelike_compat=False,
11051105
check_categorical=True,
11061106
check_category_order=True,
1107+
check_freq=True,
11071108
obj="Series",
11081109
):
11091110
"""
@@ -1142,6 +1143,10 @@ def assert_series_equal(
11421143
Whether to compare category order of internal Categoricals.
11431144
11441145
.. versionadded:: 1.0.2
1146+
check_freq : bool, default True
1147+
Whether to check the `freq` attribute on a DatetimeIndex or TimedeltaIndex.
1148+
1149+
.. versionadded:: 1.1.0
11451150
obj : str, default 'Series'
11461151
Specify object name being compared, internally used to show appropriate
11471152
assertion message.
@@ -1171,7 +1176,7 @@ def assert_series_equal(
11711176
check_categorical=check_categorical,
11721177
obj=f"{obj}.index",
11731178
)
1174-
if isinstance(left.index, (pd.DatetimeIndex, pd.TimedeltaIndex)):
1179+
if check_freq and isinstance(left.index, (pd.DatetimeIndex, pd.TimedeltaIndex)):
11751180
lidx = left.index
11761181
ridx = right.index
11771182
assert lidx.freq == ridx.freq, (lidx.freq, ridx.freq)
@@ -1274,6 +1279,7 @@ def assert_frame_equal(
12741279
check_datetimelike_compat=False,
12751280
check_categorical=True,
12761281
check_like=False,
1282+
check_freq=True,
12771283
obj="DataFrame",
12781284
):
12791285
"""
@@ -1327,6 +1333,10 @@ def assert_frame_equal(
13271333
If True, ignore the order of index & columns.
13281334
Note: index labels must match their respective rows
13291335
(same as in columns) - same labels must be with the same data.
1336+
check_freq : bool, default True
1337+
Whether to check the `freq` attribute on a DatetimeIndex or TimedeltaIndex.
1338+
1339+
.. versionadded:: 1.1.0
13301340
obj : str, default 'DataFrame'
13311341
Specify object name being compared, internally used to show appropriate
13321342
assertion message.
@@ -1433,6 +1443,7 @@ def assert_frame_equal(
14331443
check_names=check_names,
14341444
check_datetimelike_compat=check_datetimelike_compat,
14351445
check_categorical=check_categorical,
1446+
check_freq=check_freq,
14361447
obj=f'{obj}.iloc[:, {i}] (column name="{col}")',
14371448
)
14381449

pandas/tests/io/pytables/test_store.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -1552,12 +1552,16 @@ def check_col(key, name, size):
15521552
& (df_new.A > 0)
15531553
& (df_new.B < 0)
15541554
]
1555-
tm.assert_frame_equal(result, expected, check_index_type=False)
1555+
tm.assert_frame_equal(
1556+
result, expected, check_index_type=False, check_freq=False
1557+
)
15561558

15571559
# yield an empty frame
15581560
result = store.select("df", "string='foo' and string2='cool'")
15591561
expected = df_new[(df_new.string == "foo") & (df_new.string2 == "cool")]
1560-
tm.assert_frame_equal(result, expected, check_index_type=False)
1562+
tm.assert_frame_equal(
1563+
result, expected, check_index_type=False, check_freq=False
1564+
)
15611565

15621566
with ensure_clean_store(setup_path) as store:
15631567
# doc example
@@ -1577,11 +1581,16 @@ def check_col(key, name, size):
15771581
result = store.select("df_dc", "B>0")
15781582

15791583
expected = df_dc[df_dc.B > 0]
1580-
tm.assert_frame_equal(result, expected, check_index_type=False)
1584+
tm.assert_frame_equal(
1585+
result, expected, check_index_type=False, check_freq=False
1586+
)
15811587

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

15861595
with ensure_clean_store(setup_path) as store:
15871596
# doc example part 2

0 commit comments

Comments
 (0)