File tree 1 file changed +13
-9
lines changed
1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 13
13
14
14
class TestToTime :
15
15
@td .skip_if_has_locale
16
- def test_parsers_time ( self ):
17
- # GH#11818
18
- strings = [
16
+ @ pytest . mark . parametrize (
17
+ "time_string" ,
18
+ [
19
19
"14:15" ,
20
20
"1415" ,
21
21
"2:15pm" ,
@@ -25,18 +25,22 @@ def test_parsers_time(self):
25
25
"2:15:00pm" ,
26
26
"021500pm" ,
27
27
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 )
33
33
34
+ @td .skip_if_has_locale
35
+ def test_odd_format (self ):
34
36
new_string = "14.15"
35
37
msg = r"Cannot convert arg \['14\.15'\] to a time"
36
38
with pytest .raises (ValueError , match = msg ):
37
39
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 )
39
41
42
+ @td .skip_if_has_locale
43
+ def test_arraylike (self ):
40
44
arg = ["14:15" , "20:20" ]
41
45
expected_arr = [time (14 , 15 ), time (20 , 20 )]
42
46
assert to_time (arg ) == expected_arr
You can’t perform that action at this time.
0 commit comments