Skip to content

Commit 1a8071a

Browse files
authored
TST/REF: share shift tests (#44941)
1 parent 788ccc4 commit 1a8071a

File tree

4 files changed

+323
-453
lines changed

4 files changed

+323
-453
lines changed

pandas/_testing/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@
8989
assert_timedelta_array_equal,
9090
raise_assert_detail,
9191
)
92-
from pandas._testing.compat import get_dtype # noqa:F401
92+
from pandas._testing.compat import ( # noqa:F401
93+
get_dtype,
94+
get_obj,
95+
)
9396
from pandas._testing.contexts import ( # noqa:F401
9497
RNGContext,
9598
decompress_file,

pandas/_testing/compat.py

+10
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ def get_dtype(obj):
1111
return obj.dtypes.iat[0]
1212
else:
1313
return obj.dtype
14+
15+
16+
def get_obj(df: DataFrame, klass):
17+
"""
18+
For sharing tests using frame_or_series, either return the DataFrame
19+
unchanged or return it's first column as a Series.
20+
"""
21+
if klass is DataFrame:
22+
return df
23+
return df._ixs(0, axis=1)

0 commit comments

Comments
 (0)