Skip to content

Commit d4956e1

Browse files
author
MomIsBestFriend
committed
Put fromisocalendar in PY38 block
1 parent e4696b1 commit d4956e1

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

pandas/_libs/tslibs/nattype.pyx

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ from pandas._libs.tslibs.util cimport (
1919
get_nat, is_integer_object, is_float_object, is_datetime64_object,
2020
is_timedelta64_object)
2121

22+
import pandas.compat as compat
23+
2224
# ----------------------------------------------------------------------
2325
# Constants
2426
nat_strings = {'NaT', 'nat', 'NAT', 'nan', 'NaN', 'NAN'}
@@ -426,9 +428,10 @@ class NaTType(_NaT):
426428
toordinal = _make_error_func('toordinal', datetime)
427429
tzname = _make_error_func('tzname', datetime)
428430
utcoffset = _make_error_func('utcoffset', datetime)
429-
fromisocalendar = _make_error_func(
430-
'fromisocalendar', datetime.fromisocalendar.__doc__
431-
)
431+
432+
# "fromisocalendar" was introduced in 3.8
433+
if compat.PY38:
434+
fromisocalendar = _make_error_func('fromisocalendar', datetime)
432435

433436
# ----------------------------------------------------------------------
434437
# The remaining methods have docstrings copy/pasted from the analogous

pandas/tests/scalar/test_nat.py

+4
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ def test_overlap_public_nat_methods(klass, expected):
299299
if klass is Timestamp and not compat.PY37:
300300
expected.remove("fromisoformat")
301301

302+
# "fromisocalendar" was introduced in 3.8
303+
if klass is Timestamp and not compat.PY38:
304+
expected.remove("fromisocalendar")
305+
302306
assert _get_overlap_public_nat_methods(klass) == expected
303307

304308

0 commit comments

Comments
 (0)