Skip to content
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

DOC: Run doctests over pandas directory #45056

Merged
merged 2 commits into from
Dec 27, 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
19 changes: 2 additions & 17 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,8 @@ fi
if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then

MSG='Doctests' ; echo $MSG
python -m pytest --doctest-modules \
pandas/_config/ \
pandas/_libs/ \
pandas/_testing/ \
pandas/api/ \
pandas/arrays/ \
pandas/compat/ \
pandas/core \
pandas/errors/ \
pandas/io/ \
pandas/plotting/ \
pandas/tseries/ \
pandas/util/ \
pandas/_typing.py \
pandas/_version.py \
pandas/conftest.py \
pandas/testing.py
# Ignore test_*.py files or else the unit tests will run
python -m pytest --doctest-modules --ignore-glob="**/test_*.py" pandas
RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Cython Doctests' ; echo $MSG
Expand Down
17 changes: 11 additions & 6 deletions pandas/tests/arithmetic/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def switch_numexpr_min_elements(request):

# ------------------------------------------------------------------


# doctest with +SKIP for one fixture fails during setup with
# 'DoctestItem' object has no attribute 'callspec'
# due to switch_numexpr_min_elements fixture
@pytest.fixture(params=[1, np.array(1, dtype=np.int64)])
def one(request):
"""
Expand All @@ -37,11 +39,11 @@ def one(request):

Examples
--------
>>> dti = pd.date_range('2016-01-01', periods=2, freq='H')
>>> dti
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
dti + one
DatetimeIndex(['2016-01-01 01:00:00', '2016-01-01 02:00:00'],
dtype='datetime64[ns]', freq='H')
"""
Expand All @@ -61,6 +63,9 @@ def one(request):
zeros.extend([0, 0.0, -0.0])


# doctest with +SKIP for zero fixture fails during setup with
# 'DoctestItem' object has no attribute 'callspec'
# due to switch_numexpr_min_elements fixture
@pytest.fixture(params=zeros)
def zero(request):
"""
Expand All @@ -74,8 +79,8 @@ def zero(request):

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