Skip to content

Commit 2658e6f

Browse files
committed
CLN: Condense TIMEZONE ID labeling
Follow-up to pandas-devgh-26596
1 parent 8d124ea commit 2658e6f

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
from pandas import DataFrame
1614
import pandas.util.testing as tm
@@ -378,28 +376,20 @@ def unique_nulls_fixture(request):
378376
FixedOffset(0), FixedOffset(-300), timezone.utc,
379377
timezone(timedelta(hours=1)),
380378
timezone(timedelta(hours=-1), name='foo')]
381-
TIMEZONE_IDS = ['None', 'UTC', 'US/Eastern', 'Asia/Tokyp',
382-
'dateutil/US/Pacific', 'dateutil/Asia/Singapore',
383-
'dateutil.tz.tzutz()', 'dateutil.tz.tzlocal()',
384-
'pytz.FixedOffset(300)', 'pytz.FixedOffset(0)',
385-
'pytz.FixedOffset(-300)', 'datetime.timezone.utc',
386-
'datetime.timezone.+1', 'datetime.timezone.-1.named']
387379

388380

389-
@td.parametrize_fixture_doc(str(TIMEZONE_IDS))
390-
@pytest.fixture(params=TIMEZONES, ids=TIMEZONE_IDS)
381+
@pytest.fixture(params=TIMEZONES, ids=repr)
391382
def tz_naive_fixture(request):
392383
"""
393-
Fixture for trying timezones including default (None): {0}
384+
Fixture for trying timezones including default (None)
394385
"""
395386
return request.param
396387

397388

398-
@td.parametrize_fixture_doc(str(TIMEZONE_IDS[1:]))
399-
@pytest.fixture(params=TIMEZONES[1:], ids=TIMEZONE_IDS[1:])
389+
@pytest.fixture(params=TIMEZONES[1:], ids=repr)
400390
def tz_aware_fixture(request):
401391
"""
402-
Fixture for trying explicit timezones: {0}
392+
Fixture for trying explicit timezones
403393
"""
404394
return request.param
405395

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)