@@ -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
0 commit comments