Skip to content

Commit 1791f23

Browse files
committed
targeted tests
1 parent 2d73f27 commit 1791f23

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/scalar/timedelta/test_constructors.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@
1919
import pandas._testing as tm
2020

2121

22+
class TestTimedeltaConstructorKeywordBased:
23+
# Tests for constructing a Timedelta from keywords like the pytimedelta
24+
# base class
25+
def test_nanosecond_keyword(self):
26+
# GH#63216
27+
td = Timedelta(nanoseconds=1000)
28+
assert td.unit == "ns"
29+
30+
def test_noninteger_microseconds(self):
31+
# GH#63216
32+
td = Timedelta(microseconds=1.5)
33+
assert td.unit == "ns"
34+
assert td == Timedelta(nanoseconds=1500)
35+
36+
2237
class TestTimedeltaConstructorUnitKeyword:
2338
@pytest.mark.parametrize("unit", ["Y", "y", "M"])
2439
def test_unit_m_y_raises(self, unit):

0 commit comments

Comments
 (0)