Skip to content

Commit c6a7cc1

Browse files
h-vetinarigfyoung
authored andcommitted
TST: Datetime conftest.py improvements (#26596)
xref gh-23537
1 parent 7f31865 commit c6a7cc1

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

pandas/conftest.py

+15-7
Original file line numberDiff line numberDiff line change
@@ -376,19 +376,25 @@ def unique_nulls_fixture(request):
376376
FixedOffset(0), FixedOffset(-300), timezone.utc,
377377
timezone(timedelta(hours=1)),
378378
timezone(timedelta(hours=-1), name='foo')]
379+
TIMEZONE_IDS = ['None', 'UTC', 'US/Eastern', 'Asia/Tokyp',
380+
'dateutil/US/Pacific', 'dateutil/Asia/Singapore',
381+
'dateutil.tz.tzutz()', 'dateutil.tz.tzlocal()',
382+
'pytz.FixedOffset(300)', 'pytz.FixedOffset(0)',
383+
'pytz.FixedOffset(-300)', 'datetime.timezone.utc',
384+
'datetime.timezone.+1', 'datetime.timezone.-1.named']
379385

380386

381-
@td.parametrize_fixture_doc(str(TIMEZONES))
382-
@pytest.fixture(params=TIMEZONES)
387+
@td.parametrize_fixture_doc(str(TIMEZONE_IDS))
388+
@pytest.fixture(params=TIMEZONES, ids=TIMEZONE_IDS)
383389
def tz_naive_fixture(request):
384390
"""
385391
Fixture for trying timezones including default (None): {0}
386392
"""
387393
return request.param
388394

389395

390-
@td.parametrize_fixture_doc(str(TIMEZONES[1:]))
391-
@pytest.fixture(params=TIMEZONES[1:])
396+
@td.parametrize_fixture_doc(str(TIMEZONE_IDS[1:]))
397+
@pytest.fixture(params=TIMEZONES[1:], ids=TIMEZONE_IDS[1:])
392398
def tz_aware_fixture(request):
393399
"""
394400
Fixture for trying explicit timezones: {0}
@@ -398,6 +404,8 @@ def tz_aware_fixture(request):
398404

399405
# ----------------------------------------------------------------
400406
# Dtypes
407+
# ----------------------------------------------------------------
408+
401409
UNSIGNED_INT_DTYPES = ["uint8", "uint16", "uint32", "uint64"]
402410
UNSIGNED_EA_INT_DTYPES = ["UInt8", "UInt16", "UInt32", "UInt64"]
403411
SIGNED_INT_DTYPES = [int, "int8", "int16", "int32", "int64"]
@@ -409,16 +417,16 @@ def tz_aware_fixture(request):
409417
COMPLEX_DTYPES = [complex, "complex64", "complex128"]
410418
STRING_DTYPES = [str, 'str', 'U']
411419

412-
DATETIME_DTYPES = ['datetime64[ns]', 'M8[ns]']
413-
TIMEDELTA_DTYPES = ['timedelta64[ns]', 'm8[ns]']
420+
DATETIME64_DTYPES = ['datetime64[ns]', 'M8[ns]']
421+
TIMEDELTA64_DTYPES = ['timedelta64[ns]', 'm8[ns]']
414422

415423
BOOL_DTYPES = [bool, 'bool']
416424
BYTES_DTYPES = [bytes, 'bytes']
417425
OBJECT_DTYPES = [object, 'object']
418426

419427
ALL_REAL_DTYPES = FLOAT_DTYPES + ALL_INT_DTYPES
420428
ALL_NUMPY_DTYPES = (ALL_REAL_DTYPES + COMPLEX_DTYPES + STRING_DTYPES +
421-
DATETIME_DTYPES + TIMEDELTA_DTYPES + BOOL_DTYPES +
429+
DATETIME64_DTYPES + TIMEDELTA64_DTYPES + BOOL_DTYPES +
422430
OBJECT_DTYPES + BYTES_DTYPES)
423431

424432

0 commit comments

Comments
 (0)