@@ -1104,6 +1104,7 @@ def assert_series_equal(
1104
1104
check_datetimelike_compat = False ,
1105
1105
check_categorical = True ,
1106
1106
check_category_order = True ,
1107
+ check_freq = True ,
1107
1108
obj = "Series" ,
1108
1109
):
1109
1110
"""
@@ -1142,6 +1143,10 @@ def assert_series_equal(
1142
1143
Whether to compare category order of internal Categoricals.
1143
1144
1144
1145
.. 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
1145
1150
obj : str, default 'Series'
1146
1151
Specify object name being compared, internally used to show appropriate
1147
1152
assertion message.
@@ -1171,7 +1176,7 @@ def assert_series_equal(
1171
1176
check_categorical = check_categorical ,
1172
1177
obj = f"{ obj } .index" ,
1173
1178
)
1174
- if isinstance (left .index , (pd .DatetimeIndex , pd .TimedeltaIndex )):
1179
+ if check_freq and isinstance (left .index , (pd .DatetimeIndex , pd .TimedeltaIndex )):
1175
1180
lidx = left .index
1176
1181
ridx = right .index
1177
1182
assert lidx .freq == ridx .freq , (lidx .freq , ridx .freq )
@@ -1274,6 +1279,7 @@ def assert_frame_equal(
1274
1279
check_datetimelike_compat = False ,
1275
1280
check_categorical = True ,
1276
1281
check_like = False ,
1282
+ check_freq = True ,
1277
1283
obj = "DataFrame" ,
1278
1284
):
1279
1285
"""
@@ -1327,6 +1333,10 @@ def assert_frame_equal(
1327
1333
If True, ignore the order of index & columns.
1328
1334
Note: index labels must match their respective rows
1329
1335
(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
1330
1340
obj : str, default 'DataFrame'
1331
1341
Specify object name being compared, internally used to show appropriate
1332
1342
assertion message.
@@ -1433,6 +1443,7 @@ def assert_frame_equal(
1433
1443
check_names = check_names ,
1434
1444
check_datetimelike_compat = check_datetimelike_compat ,
1435
1445
check_categorical = check_categorical ,
1446
+ check_freq = check_freq ,
1436
1447
obj = f'{ obj } .iloc[:, { i } ] (column name="{ col } ")' ,
1437
1448
)
1438
1449
0 commit comments