8000 TST/CLN: Fixturize frame/test_analytics by h-vetinari · Pull Request #22733 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

TST/CLN: Fixturize frame/test_analytics #22733

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 15 commits into from
Oct 6, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Revert "Final touches"
This reverts commit 56020d7.
  • Loading branch information
h-vetinari committed Oct 5, 2018
commit 7a56cfbcfa267509fd8139a3a62c8a7226cc4775
9 changes: 5 additions & 4 deletions pandas/tests/frame/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def assert_stat_op_calc(opname, alternative, main_frame, has_skipna=True,

if check_dates:
df = DataFrame({'b': date_range('1/1/2001', periods=2)})
result = getattr(df, opname)()
_f = getattr(df, opname)
result = _f()
assert isinstance(result, Series)

df['a'] = lrange(len(df))
Expand Down Expand Up @@ -85,7 +86,7 @@ def wrapper(x):
r0 = getattr(all_na, opname)(axis=0)
r1 = getattr(all_na, opname)(axis=1)
if opname in ['sum', 'prod']:
unit = 1 if opname == 'prod' else 0 # result for empty sum/prod
unit = int(opname == 'prod')
expected = pd.Series(unit, index=r0.index, dtype=r0.dtype)
tm.assert_series_equal(r0, expected)
expected = pd.Series(unit, index=r1.index, dtype=r1.dtype)
Expand Down Expand Up @@ -136,7 +137,7 @@ def wrapper(x):
check_dtype=False)

# bad axis
tm.assert_raises_regex(ValueError, 'No axis named 2', f, axis=2)
pytest.raises(ValueError, f, axis=2)

# all NA case
if has_skipna:
Expand All @@ -155,7 +156,7 @@ def assert_bool_op_api(opname, bool_frame_with_na, float_string_frame,
has_bool_only=False):
# make sure op works on mixed-type frame
mixed = float_string_frame
mixed['_bool_'] = np.random.randn(len(mixed)) > 0.5
mixed['_bool_'] = np.random.randn(len(mixed)) > 0
getattr(mixed, opname)(axis=0)
getattr(mixed, opname)(axis=1)

Expand Down
0