From 053b8a47e8911af46b1e37b8e52e51300dba12ef Mon Sep 17 00:00:00 2001 From: dalgarno <32097481+dalgarno@users.noreply.github.com> Date: Mon, 18 Nov 2019 01:40:47 +0000 Subject: [PATCH] TST: Add docstrings to arithmetic fixtures (#29441) --- pandas/tests/arithmetic/conftest.py | 36 ++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/pandas/tests/arithmetic/conftest.py b/pandas/tests/arithmetic/conftest.py index 774ff14398bdb4..1f8fdfd671856f 100644 --- a/pandas/tests/arithmetic/conftest.py +++ b/pandas/tests/arithmetic/conftest.py @@ -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 @@ -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, + 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