Skip to content

TST/REF: share shift tests #44941

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 7 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pandas/_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@
assert_timedelta_array_equal,
raise_assert_detail,
)
from pandas._testing.compat import get_dtype # noqa:F401
from pandas._testing.compat import ( # noqa:F401
get_dtype,
get_obj,
)
from pandas._testing.contexts import ( # noqa:F401
RNGContext,
decompress_file,
Expand Down
10 changes: 10 additions & 0 deletions pandas/_testing/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ def get_dtype(obj):
return obj.dtypes.iat[0]
else:
return obj.dtype


def get_obj(df: DataFrame, klass):
"""
For sharing tests using frame_or_series, either return the DataFrame
unchanged or return it's first column as a Series.
"""
if klass is DataFrame:
return df
return df._ixs(0, axis=1)
Loading