Skip to content

Commit d0d95c5

Browse files
committed
remove some now unnecessary warnings
1 parent 1df3161 commit d0d95c5

File tree

1 file changed

+10
-35
lines changed

1 file changed

+10
-35
lines changed

pandas/tests/scalar/period/test_period.py

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ def test_from_td64nat_raises(self):
5151
Period(td, freq="D")
5252

5353
def test_construction(self):
54-
with tm.assert_produces_warning(
55-
UserWarning,
56-
match="Parsing datetime strings without a format specified",
57-
):
58-
i1 = Period("1/1/2005", freq="M")
59-
i2 = Period("Jan 2005")
54+
i1 = Period("1/1/2005", freq="M")
55+
i2 = Period("Jan 2005")
6056

6157
assert i1 == i2
6258

@@ -85,11 +81,7 @@ def test_construction(self):
8581
assert i1 == i2
8682

8783
i1 = Period(year=2005, month=3, day=1, freq="D")
88-
with tm.assert_produces_warning(
89-
UserWarning,
90-
match="Parsing datetime strings without a format specified",
91-
):
92-
i2 = Period("3/1/2005", freq="D")
84+
i2 = Period("3/1/2005", freq="D")
9385
assert i1 == i2
9486

9587
i3 = Period(year=2005, month=3, day=1, freq="d")
@@ -177,19 +169,11 @@ def test_construction_bday(self):
177169
def test_construction_quarter(self):
178170

179171
i1 = Period(year=2005, quarter=1, freq="Q")
180-
with tm.assert_produces_warning(
181-
UserWarning,
182-
match="Parsing datetime strings without a format specified",
183-
):
184-
i2 = Period("1/1/2005", freq="Q")
172+
i2 = Period("1/1/2005", freq="Q")
185173
assert i1 == i2
186174

187175
i1 = Period(year=2005, quarter=3, freq="Q")
188-
with tm.assert_produces_warning(
189-
UserWarning,
190-
match="Parsing datetime strings without a format specified",
191-
):
192-
i2 = Period("9/1/2005", freq="Q")
176+
i2 = Period("9/1/2005", freq="Q")
193177
assert i1 == i2
194178

195179
i1 = Period("2005Q1")
@@ -264,13 +248,9 @@ def test_construction_month(self):
264248
assert i1 == i5
265249

266250
def test_period_constructor_offsets(self):
267-
with tm.assert_produces_warning(
268-
UserWarning,
269-
match="Parsing datetime strings without a format specified",
270-
):
271-
assert Period("1/1/2005", freq=offsets.MonthEnd()) == Period(
272-
"1/1/2005", freq="M"
273-
)
251+
assert Period("1/1/2005", freq=offsets.MonthEnd()) == Period(
252+
"1/1/2005", freq="M"
253+
)
274254
assert Period("2005", freq=offsets.YearEnd()) == Period("2005", freq="A")
275255
assert Period("2005", freq=offsets.MonthEnd()) == Period("2005", freq="M")
276256
assert Period("3/10/2012", freq=offsets.BusinessDay()) == Period(
@@ -301,8 +281,7 @@ def test_period_constructor_offsets(self):
301281
)
302282

303283
with tm.assert_produces_warning(
304-
UserWarning,
305-
match="Parsing datetime strings without a format specified",
284+
UserWarning, match="without a format specified"
306285
):
307286
assert Period(200701, freq=offsets.MonthEnd()) == Period(200701, freq="M")
308287

@@ -313,11 +292,7 @@ def test_period_constructor_offsets(self):
313292
assert i2.year == 18695
314293

315294
i1 = Period(datetime(2007, 1, 1), freq="M")
316-
with tm.assert_produces_warning(
317-
UserWarning,
318-
match="Parsing datetime strings without a format specified",
319-
):
320-
i2 = Period("200701", freq="M")
295+
i2 = Period("2007-01", freq="M")
321296
assert i1 == i2
322297

323298
i1 = Period(date(2007, 1, 1), freq="M")

0 commit comments

Comments
 (0)