Skip to content

TST: Add docstrings to arithmetic fixtures #29441

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 6 commits into from
Nov 18, 2019
Merged
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
36 changes: 33 additions & 3 deletions pandas/tests/arithmetic/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,24 @@ def id_func(x):

@pytest.fixture(params=[1, np.array(1, dtype=np.int64)])
def one(request):
# zero-dim integer array behaves like an integer
"""
Several variants of integer value 1. The zero-dim integer array
behaves like an integer.

This fixture can be used to check that datetimelike indexes handle
addition and subtraction of integers and zero-dimensional arrays
of integers.

Examples
--------
>>> dti = pd.date_range('2016-01-01', periods=2, freq='H')
>>> dti
DatetimeIndex(['2016-01-01 00:00:00', '2016-01-01 01:00:00'],
dtype='datetime64[ns]', freq='H')
>>> dti + one
DatetimeIndex(['2016-01-01 01:00:00', '2016-01-01 02:00:00'],
dtype='datetime64[ns]', freq='H')
"""
return request.param


Expand All @@ -40,8 +57,21 @@ def one(request):

@pytest.fixture(params=zeros)
def zero(request):
# For testing division by (or of) zero for Index with length 5, this
# gives several scalar-zeros and length-5 vector-zeros
"""
Several types of scalar zeros and length 5 vectors of zeros.

This fixture can be used to check that numeric-dtype indexes handle
division by any zero numeric-dtype.

Uses vector of length 5 for broadcasting with `numeric_idx` fixture,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you model the extended description here after what you have in the other method? I find that quite nice, but don't really understand this one

which creates numeric-dtype vectors also of length 5.

Examples
--------
>>> arr = pd.RangeIndex(5)
>>> arr / zeros
Float64Index([nan, inf, inf, inf, inf], dtype='float64')
"""
return request.param


Expand Down