@@ -51,12 +51,8 @@ def test_from_td64nat_raises(self):
51
51
Period (td , freq = "D" )
52
52
53
53
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" )
60
56
61
57
assert i1 == i2
62
58
@@ -85,11 +81,7 @@ def test_construction(self):
85
81
assert i1 == i2
86
82
87
83
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" )
93
85
assert i1 == i2
94
86
95
87
i3 = Period (year = 2005 , month = 3 , day = 1 , freq = "d" )
@@ -177,19 +169,11 @@ def test_construction_bday(self):
177
169
def test_construction_quarter (self ):
178
170
179
171
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" )
185
173
assert i1 == i2
186
174
187
175
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" )
193
177
assert i1 == i2
194
178
195
179
i1 = Period ("2005Q1" )
@@ -264,27 +248,15 @@ def test_construction_month(self):
264
248
assert i1 == i5
265
249
266
250
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
+ )
274
254
assert Period ("2005" , freq = offsets .YearEnd ()) == Period ("2005" , freq = "A" )
275
255
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" )
288
260
289
261
assert Period (
290
262
year = 2005 , quarter = 1 , freq = offsets .QuarterEnd (startingMonth = 12 )
@@ -309,8 +281,7 @@ def test_period_constructor_offsets(self):
309
281
)
310
282
311
283
with tm .assert_produces_warning (
312
- UserWarning ,
313
- match = "Parsing datetime strings without a format specified" ,
284
+ UserWarning , match = "without a format specified"
314
285
):
315
286
assert Period (200701 , freq = offsets .MonthEnd ()) == Period (200701 , freq = "M" )
316
287
@@ -321,11 +292,7 @@ def test_period_constructor_offsets(self):
321
292
assert i2 .year == 18695
322
293
323
294
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" )
329
296
assert i1 == i2
330
297
331
298
i1 = Period (date (2007 , 1 , 1 ), freq = "M" )
0 commit comments