@@ -89,6 +89,9 @@ def test_construction():
89
89
with pytest .raises (ValueError ):
90
90
Timedelta ('3.1415' )
91
91
92
+ with pytest .raises (ValueError ):
93
+ Timedelta ('2000' )
94
+
92
95
# invalid construction
93
96
tm .assert_raises_regex (ValueError , "cannot construct a Timedelta" ,
94
97
lambda : Timedelta ())
@@ -213,10 +216,11 @@ def test_td_constructor_value_error():
213
216
214
217
215
218
@pytest .mark .parametrize ("str_unit, unit, expectation" , [
216
- ("" , "s" , tm .do_not_raise ),
217
- ("s" , "s" , pytest .raises (ValueError )),
218
- ("" , None , pytest .raises (ValueError )),
219
- ("s" , "d" , pytest .raises (ValueError )),])
219
+ ("" , "s" , tm .do_not_raise ), # Expected case
220
+ ("s" , "s" , pytest .raises (ValueError )), # Units doubly defined
221
+ ("s" , "d" , pytest .raises (ValueError )),
222
+ ("" , None , pytest .raises (ValueError )), # No units
223
+ ])
220
224
def test_string_with_unit (str_unit , unit , expectation ):
221
225
with expectation :
222
226
val_str = "10{}" .format (str_unit )
0 commit comments