File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 1313
1414class TestToTime :
1515 @td .skip_if_has_locale
16- def test_parsers_time ( self ):
17- # GH#11818
18- strings = [
16+ @ pytest . mark . parametrize (
17+ "time_string" ,
18+ [
1919 "14:15" ,
2020 "1415" ,
2121 "2:15pm" ,
@@ -25,18 +25,22 @@ def test_parsers_time(self):
2525 "2:15:00pm" ,
2626 "021500pm" ,
2727 time (14 , 15 ),
28- ]
29- expected = time ( 14 , 15 )
30-
31- for time_string in strings :
32- assert to_time (time_string ) == expected
28+ ],
29+ )
30+ def test_parsers_time ( self , time_string ):
31+ # GH#11818
32+ assert to_time (time_string ) == time ( 14 , 15 )
3333
34+ @td .skip_if_has_locale
35+ def test_odd_format (self ):
3436 new_string = "14.15"
3537 msg = r"Cannot convert arg \['14\.15'\] to a time"
3638 with pytest .raises (ValueError , match = msg ):
3739 to_time (new_string )
38- assert to_time (new_string , format = "%H.%M" ) == expected
40+ assert to_time (new_string , format = "%H.%M" ) == time ( 14 , 15 )
3941
42+ @td .skip_if_has_locale
43+ def test_arraylike (self ):
4044 arg = ["14:15" , "20:20" ]
4145 expected_arr = [time (14 , 15 ), time (20 , 20 )]
4246 assert to_time (arg ) == expected_arr
You can’t perform that action at this time.
0 commit comments