Skip to content

CI: Start Testing on Python 3.11 #47032

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

Closed
wants to merge 15 commits into from
Closed
9 changes: 5 additions & 4 deletions .github/workflows/python-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:

jobs:
build:
if: false # Comment this line out to "unfreeze"
#if: false # Comment this line out to "unfreeze"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -56,12 +56,13 @@ jobs:

# TODO: GH#44980 https://github.com/pypa/setuptools/issues/2941
- name: Install dependencies
shell: bash -el {0}
#shell: bash -el {0}
run: |
python -m pip install --upgrade pip "setuptools<60.0.0" wheel
pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy
# pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy
pip install git+https://github.com/nedbat/coveragepy.git
pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov
pip install git+https://github.com/numpy/numpy.git
pip install cython python-dateutil pytz hypothesis pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio
pip list

- name: Build Pandas
Expand Down
38 changes: 17 additions & 21 deletions pandas/tests/scalar/test_nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,14 @@ def test_missing_public_nat_methods(klass, expected):
assert missing == expected


def _get_overlap_public_nat_methods(klass, as_tuple=False):
def _get_overlap_public_nat_methods(klass):
"""
Get overlapping public methods between NaT and another class.

Parameters
----------
klass : type
The class to compare with NaT
as_tuple : bool, default False
Whether to return a list of tuples of the form (klass, method).

Returns
-------
Expand All @@ -249,9 +247,6 @@ def _get_overlap_public_nat_methods(klass, as_tuple=False):
ts_names = dir(Timestamp)
overlap = [x for x in overlap if x not in ts_names]

if as_tuple:
overlap = [(klass, method) for method in overlap]

overlap.sort()
return overlap

Expand Down Expand Up @@ -315,30 +310,31 @@ def test_overlap_public_nat_methods(klass, expected):


@pytest.mark.parametrize(
"compare",
"klass",
(
_get_overlap_public_nat_methods(Timestamp, True)
+ _get_overlap_public_nat_methods(Timedelta, True)
Timestamp,
Timedelta
),
Copy link
Contributor

@EwoutH EwoutH May 24, 2022

Choose a reason for hiding this comment

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

If you combine those four lines to a single line with (Timestamp, Timedelta),, it conforms to black formatting and the linting error will go away (see the CI run).

-    (
-        Timestamp,
-        Timedelta
-    ),
+    (Timestamp, Timedelta),

)
def test_nat_doc_strings(compare):
def test_nat_doc_strings(klass):
# see gh-17327
#
# The docstrings for overlapping methods should match.
klass, method = compare
klass_doc = getattr(klass, method).__doc__
methods = _get_overlap_public_nat_methods(klass)
for method in methods:
klass_doc = getattr(klass, method).__doc__

# Ignore differences with Timestamp.isoformat() as they're intentional
if klass == Timestamp and method == "isoformat":
return
# Ignore differences with Timestamp.isoformat() as they're intentional
if klass == Timestamp and method == "isoformat":
return

if method == "to_numpy":
# GH#44460 can return either dt64 or td64 depending on dtype,
# different docstring is intentional
return
if method == "to_numpy":
# GH#44460 can return either dt64 or td64 depending on dtype,
# different docstring is intentional
return

nat_doc = getattr(NaT, method).__doc__
assert klass_doc == nat_doc
nat_doc = getattr(NaT, method).__doc__
assert klass_doc == nat_doc


_ops = {
Expand Down