@@ -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,13 +248,9 @@ 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
256
assert Period ("3/10/2012" , freq = offsets .BusinessDay ()) == Period (
@@ -301,8 +281,7 @@ def test_period_constructor_offsets(self):
301
281
)
302
282
303
283
with tm .assert_produces_warning (
304
- UserWarning ,
305
- match = "Parsing datetime strings without a format specified" ,
284
+ UserWarning , match = "without a format specified"
306
285
):
307
286
assert Period (200701 , freq = offsets .MonthEnd ()) == Period (200701 , freq = "M" )
308
287
@@ -313,11 +292,7 @@ def test_period_constructor_offsets(self):
313
292
assert i2 .year == 18695
314
293
315
294
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" )
321
296
assert i1 == i2
322
297
323
298
i1 = Period (date (2007 , 1 , 1 ), freq = "M" )
0 commit comments