Skip to content

Commit 38871c7

Browse files
author
MarcoGorelli
committed
keep format_is_iso as cdef, make def wrapper for test
1 parent 030bcb2 commit 38871c7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

pandas/_libs/tslibs/strptime.pxd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from numpy cimport int64_t
22

33

4-
cpdef bint format_is_iso(str f)
54
cdef bint parse_today_now(str val, int64_t* iresult, bint utc)

pandas/_libs/tslibs/strptime.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ from pandas._libs.tslibs.timestamps import Timestamp
5454

5555
cnp.import_array()
5656

57-
cpdef bint format_is_iso(f: str):
57+
cdef bint format_is_iso(f: str):
5858
"""
5959
Does format match the iso8601 set that can be handled by the C parser?
6060
Generally of form YYYY-MM-DDTHH:MM:SS - date separator can be different
@@ -74,6 +74,11 @@ cpdef bint format_is_iso(f: str):
7474
return False
7575

7676

77+
def _test_format_is_iso(f: str) -> bool:
78+
"""Only used in testing."""
79+
return format_is_iso(f)
80+
81+
7782
cdef bint parse_today_now(str val, int64_t* iresult, bint utc):
7883
# We delay this check for as long as possible
7984
# because it catches relatively rare cases

pandas/tests/tslibs/test_parsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def test_parse_time_string_check_instance_type_raise_exception():
315315
)
316316
def test_is_iso_format(fmt, expected):
317317
# see gh-41047
318-
result = strptime.format_is_iso(fmt)
318+
result = strptime._test_format_is_iso(fmt)
319319
assert result == expected
320320

321321

0 commit comments

Comments
 (0)