Skip to content
Closed
15 changes: 8 additions & 7 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 @@ -55,13 +55,14 @@ jobs:
python-version: '3.11-dev'

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

- name: Build Pandas
run: |
Expand Down
1 change: 1 addition & 0 deletions pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

PY39 = sys.version_info >= (3, 9)
PY310 = sys.version_info >= (3, 10)
PY311 = sys.version_info >= (3, 11)
PYPY = platform.python_implementation() == "PyPy"
IS64 = sys.maxsize > 2**32

Expand Down
8 changes: 8 additions & 0 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@
# Import "zoneinfo" could not be resolved (reportMissingImports)
import zoneinfo # type: ignore[no-redef]

# Although zoneinfo can be imported in Py39, it is effectively
# "not available" without tzdata/IANA tz data.
# We will set zoneinfo to not found in this case
try:
utc_zoneinfo = zoneinfo.ZoneInfo("UTC")
except zoneinfo.ZoneInfoNotFoundError:
zoneinfo = None

# Until https://github.com/numpy/numpy/issues/19078 is sorted out, just suppress
suppress_npdev_promotion_warning = pytest.mark.filterwarnings(
"ignore:Promotion of numbers and bools:FutureWarning"
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/io/parser/common/test_read_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import numpy as np
import pytest

from pandas.compat import PY311
from pandas.errors import (
EmptyDataError,
ParserError,
Expand Down Expand Up @@ -230,7 +231,7 @@ def test_null_byte_char(all_parsers):
names = ["a", "b"]
parser = all_parsers

if parser.engine == "c":
if parser.engine == "c" or PY311:
expected = DataFrame([[np.nan, "foo"]], columns=names)
out = parser.read_csv(StringIO(data), names=names)
tm.assert_frame_equal(out, expected)
Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/io/parser/test_quoting.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ def test_null_quote_char(all_parsers, quoting, quote_char):

if quoting != csv.QUOTE_NONE:
# Sanity checking.
msg = "quotechar must be set if quoting enabled"
msg = (
r"(quotechar must be set if quoting enabled|"
r'"quotechar" must be a 1-character string)'
)

with pytest.raises(TypeError, match=msg):
parser.read_csv(StringIO(data), **kwargs)
Expand Down
39 changes: 16 additions & 23 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,28 @@ def test_overlap_public_nat_methods(klass, expected):


@pytest.mark.parametrize(
"compare",
(
_get_overlap_public_nat_methods(Timestamp, True)
+ _get_overlap_public_nat_methods(Timedelta, True)
),
"klass",
(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