@@ -917,10 +917,7 @@ def test_multi_index_parse_dates(all_parsers, index_col):
917
917
columns = ["A" , "B" , "C" ],
918
918
index = index ,
919
919
)
920
- with tm .assert_produces_warning (
921
- UserWarning , match = "Parsing datetime strings without a format specified"
922
- ):
923
- result = parser .read_csv (StringIO (data ), index_col = index_col , parse_dates = True )
920
+ result = parser .read_csv (StringIO (data ), index_col = index_col , parse_dates = True )
924
921
tm .assert_frame_equal (result , expected )
925
922
926
923
@@ -1168,15 +1165,16 @@ def test_multiple_date_cols_chunked(all_parsers):
1168
1165
columns = ["nominal" , "ID" , "actualTime" , "A" , "B" , "C" , "D" , "E" ],
1169
1166
)
1170
1167
expected = expected .set_index ("nominal" )
1171
- with parser .read_csv_check_warnings (
1172
- UserWarning ,
1173
- "Parsing datetime strings without a format specified" ,
1168
+ with parser .read_csv (
1174
1169
StringIO (data ),
1175
1170
parse_dates = {"nominal" : [1 , 2 ]},
1176
1171
index_col = "nominal" ,
1177
1172
chunksize = 2 ,
1178
1173
) as reader :
1179
- chunks = list (reader )
1174
+ with tm .assert_produces_warning (
1175
+ UserWarning , match = "without a format specified"
1176
+ ):
1177
+ chunks = list (reader )
1180
1178
1181
1179
tm .assert_frame_equal (chunks [0 ], expected [:2 ])
1182
1180
tm .assert_frame_equal (chunks [1 ], expected [2 :4 ])
@@ -1592,9 +1590,7 @@ def date_parser(dt, time):
1592
1590
arr = [datetime .combine (d , t ) for d , t in zip (dt , time )]
1593
1591
return np .array (arr , dtype = "datetime64[s]" )
1594
1592
1595
- result = parser .read_csv_with_warnings (
1596
- UserWarning ,
1597
- "without a format specified" ,
1593
+ result = parser .read_csv (
1598
1594
StringIO (data ),
1599
1595
date_parser = date_parser ,
1600
1596
parse_dates = {"datetime" : ["date" , "time" ]},
@@ -1678,34 +1674,13 @@ def test_parse_timezone(all_parsers):
1678
1674
1679
1675
@skip_pyarrow
1680
1676
@pytest .mark .parametrize (
1681
- "date_string, warning, msg" ,
1682
- [
1683
- ("32/32/2019" , None , "" ),
1684
- ("02/30/2019" , None , "" ),
1685
- ("13/13/2019" , None , "" ),
1686
- ("13/2019" , None , "" ),
1687
- (
1688
- "a3/11/2018" ,
1689
- UserWarning ,
1690
- "Parsing datetime strings without a format specified" ,
1691
- ),
1692
- (
1693
- "10/11/2o17" ,
1694
- UserWarning ,
1695
- "Parsing datetime strings without a format specified" ,
1696
- ),
1697
- ],
1677
+ "date_string" ,
1678
+ ["32/32/2019" , "02/30/2019" , "13/13/2019" , "13/2019" , "a3/11/2018" , "10/11/2o17" ],
1698
1679
)
1699
- def test_invalid_parse_delimited_date (all_parsers , date_string , warning , msg ):
1680
+ def test_invalid_parse_delimited_date (all_parsers , date_string ):
1700
1681
parser = all_parsers
1701
1682
expected = DataFrame ({0 : [date_string ]}, dtype = "object" )
1702
- result = parser .read_csv_check_warnings (
1703
- warning ,
1704
- msg ,
1705
- StringIO (date_string ),
1706
- header = None ,
1707
- parse_dates = [0 ],
1708
- )
1683
+ result = parser .read_csv (StringIO (date_string ), header = None , parse_dates = [0 ])
1709
1684
tm .assert_frame_equal (result , expected )
1710
1685
1711
1686
0 commit comments