Skip to content

Commit 2cc2d21

Browse files
author
Victor
committed
Passing tests.
1 parent b4d8f0f commit 2cc2d21

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

pandas/_libs/tslibs/timedeltas.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from numpy cimport int64_t
44

55
# Exposed for tslib, not intended for outside use.
6-
cdef parse_timedelta_string(object ts, object specified_unit=None)
6+
cdef parse_timedelta_string(object ts, specified_unit=*)
77
cpdef int64_t cast_from_unit(object ts, object unit) except? -1
88
cpdef int64_t delta_to_nanoseconds(delta) except? -1
99
cpdef convert_to_timedelta64(object ts, object unit)

pandas/tests/scalar/timedelta/test_construction.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ def test_construction():
8585
with pytest.raises(ValueError):
8686
Timedelta('10 days -1 h 1.5m 1s 3us')
8787

88-
# no units specified
89-
with pytest.raises(ValueError):
90-
Timedelta('3.1415')
91-
9288
# invalid construction
9389
tm.assert_raises_regex(ValueError, "cannot construct a Timedelta",
9490
lambda: Timedelta())
@@ -223,17 +219,14 @@ def __exit__(self, exc_type, exc_val, exc_tb):
223219
@pytest.mark.parametrize("redundant_unit, expectation", [
224220
("", not_raises()),
225221
("d", pytest.raises(ValueError)),
226-
("us", pytest.raises(ValueError)),
227-
])
222+
("us", pytest.raises(ValueError))])
228223
@pytest.mark.parametrize("unit", [
229-
"d", "m", "s", "us"
230-
])
224+
"d", "m", "s", "us"])
231225
@pytest.mark.parametrize("sign", [
232-
+1, -1
233-
])
226+
+1, -1])
234227
@pytest.mark.parametrize("num", [
235-
0.001, 1, 10
236-
])
228+
0.001, 1, 10])
237229
def test_string_with_unit(num, sign, unit, redundant_unit, expectation):
238230
with expectation:
239-
assert Timedelta(str(sign*num)+redundant_unit, unit=unit) == Timedelta(sign*num, unit=unit)
231+
assert Timedelta(str(sign * num) + redundant_unit, unit=unit) \
232+
== Timedelta(sign * num, unit=unit)

0 commit comments

Comments
 (0)