Skip to content

Commit 9e799cb

Browse files
committed
CLN: Condense TIMEZONE ID labeling
Follow-up to gh-26596
1 parent addc5fc commit 9e799cb

File tree

2 files changed

+4
-39
lines changed

2 files changed

+4
-39
lines changed

pandas/conftest.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import pytest
1010
from pytz import FixedOffset, utc
1111

12-
import pandas.util._test_decorators as td
13-
1412
import pandas as pd
1513

1614
hypothesis.settings.register_profile(
@@ -376,28 +374,20 @@ def unique_nulls_fixture(request):
376374
FixedOffset(0), FixedOffset(-300), timezone.utc,
377375
timezone(timedelta(hours=1)),
378376
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']
385377

386378

387-
@td.parametrize_fixture_doc(str(TIMEZONE_IDS))
388-
@pytest.fixture(params=TIMEZONES, ids=TIMEZONE_IDS)
379+
@pytest.fixture(params=TIMEZONES, ids=repr)
389380
def tz_naive_fixture(request):
390381
"""
391-
Fixture for trying timezones including default (None): {0}
382+
Fixture for trying timezones including default (None)
392383
"""
393384
return request.param
394385

395386

396-
@td.parametrize_fixture_doc(str(TIMEZONE_IDS[1:]))
397-
@pytest.fixture(params=TIMEZONES[1:], ids=TIMEZONE_IDS[1:])
387+
@pytest.fixture(params=TIMEZONES[1:], ids=repr)
398388
def tz_aware_fixture(request):
399389
"""
400-
Fixture for trying explicit timezones: {0}
390+
Fixture for trying explicit timezones
401391
"""
402392
return request.param
403393

pandas/util/_test_decorators.py

-25
Original file line numberDiff line numberDiff line change
@@ -157,28 +157,3 @@ def decorated_func(func):
157157
"installed->{installed}".format(
158158
enabled=_USE_NUMEXPR,
159159
installed=_NUMEXPR_INSTALLED))
160-
161-
162-
def parametrize_fixture_doc(*args):
163-
"""
164-
Intended for use as a decorator for parametrized fixture,
165-
this function will wrap the decorated function with a pytest
166-
``parametrize_fixture_doc`` mark. That mark will format
167-
initial fixture docstring by replacing placeholders {0}, {1} etc
168-
with parameters passed as arguments.
169-
170-
Parameters:
171-
----------
172-
args: iterable
173-
Positional arguments for docstring.
174-
175-
Returns:
176-
-------
177-
documented_fixture: function
178-
The decorated function wrapped within a pytest
179-
``parametrize_fixture_doc`` mark
180-
"""
181-
def documented_fixture(fixture):
182-
fixture.__doc__ = fixture.__doc__.format(*args)
183-
return fixture
184-
return documented_fixture

0 commit comments

Comments
 (0)