Skip to content

Commit dee9018

Browse files
committed
remove some now unnecessary warnings
1 parent 73573d8 commit dee9018

File tree

1 file changed

+14
-47
lines changed

1 file changed

+14
-47
lines changed

pandas/tests/scalar/period/test_period.py

Lines changed: 14 additions & 47 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,27 +248,15 @@ 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")
276-
with tm.assert_produces_warning(
277-
UserWarning,
278-
match="Parsing datetime strings without a format specified",
279-
):
280-
assert Period("3/10/12", freq=offsets.BusinessDay()) == Period(
281-
"3/10/12", freq="B"
282-
)
283-
with tm.assert_produces_warning(
284-
UserWarning,
285-
match="Parsing datetime strings without a format specified",
286-
):
287-
assert Period("3/10/12", freq=offsets.Day()) == Period("3/10/12", freq="D")
256+
assert Period("3/10/2012", freq=offsets.BusinessDay()) == Period(
257+
"3/10/2012", freq="B"
258+
)
259+
assert Period("3/10/2012", freq=offsets.Day()) == Period("3/10/2012", freq="D")
288260

289261
assert Period(
290262
year=2005, quarter=1, freq=offsets.QuarterEnd(startingMonth=12)
@@ -309,8 +281,7 @@ def test_period_constructor_offsets(self):
309281
)
310282

311283
with tm.assert_produces_warning(
312-
UserWarning,
313-
match="Parsing datetime strings without a format specified",
284+
UserWarning, match="without a format specified"
314285
):
315286
assert Period(200701, freq=offsets.MonthEnd()) == Period(200701, freq="M")
316287

@@ -321,11 +292,7 @@ def test_period_constructor_offsets(self):
321292
assert i2.year == 18695
322293

323294
i1 = Period(datetime(2007, 1, 1), freq="M")
324-
with tm.assert_produces_warning(
325-
UserWarning,
326-
match="Parsing datetime strings without a format specified",
327-
):
328-
i2 = Period("200701", freq="M")
295+
i2 = Period("2007-01", freq="M")
329296
assert i1 == i2
330297

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

0 commit comments

Comments
 (0)