Skip to content

Commit 4152a31

Browse files
jbrockmendeljreback
authored andcommitted
follow-up to #17943, closes #5168 (#18033)
1 parent e886af5 commit 4152a31

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

doc/source/whatsnew/v0.22.0.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ Other API Changes
4242

4343
- ``NaT`` division with :class:`datetime.timedelta` will now return ``NaN`` instead of raising (:issue:`17876`)
4444
- All-NaN levels in ``MultiIndex`` are now assigned float rather than object dtype, coherently with flat indexes (:issue:`17929`).
45-
- :class:`Timestamp` will no longer silently ignore unused or invalid `tz` or `tzinfo` arguments (:issue:`17690`)
45+
- :class:`Timestamp` will no longer silently ignore unused or invalid `tz` or `tzinfo` keyword arguments (:issue:`17690`)
46+
- :class:`Timestamp` will no longer silently ignore invalid `freq` arguments (:issue:`5168`)
4647
- :class:`CacheableOffset` and :class:`WeekDay` are no longer available in the `tseries.offsets` module (:issue:`17830`)
47-
-
4848

4949
.. _whatsnew_0220.deprecations:
5050

pandas/tests/scalar/test_timestamp.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,19 @@ def test_constructor_invalid(self):
176176
Timestamp(Period('1000-01-01'))
177177

178178
def test_constructor_invalid_tz(self):
179-
# GH#17690, GH#5168
179+
# GH#17690
180180
with tm.assert_raises_regex(TypeError, 'must be a datetime.tzinfo'):
181181
Timestamp('2017-10-22', tzinfo='US/Eastern')
182182

183183
with tm.assert_raises_regex(ValueError, 'at most one of'):
184184
Timestamp('2017-10-22', tzinfo=utc, tz='UTC')
185185

186+
with tm.assert_raises_regex(ValueError, "Invalid frequency:"):
187+
# GH#5168
188+
# case where user tries to pass tz as an arg, not kwarg, gets
189+
# interpreted as a `freq`
190+
Timestamp('2012-01-01', 'US/Pacific')
191+
186192
def test_constructor_tz_or_tzinfo(self):
187193
# GH#17943, GH#17690, GH#5168
188194
stamps = [Timestamp(year=2017, month=10, day=22, tz='UTC'),

0 commit comments

Comments
 (0)