Skip to content

REF: Timestamp constructor tests #31583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions pandas/tests/indexes/datetimes/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,17 +950,3 @@ def test_datetimeindex_constructor_misc(self):
)
assert len(idx1) == len(idx2)
assert idx1.freq == idx2.freq


def test_timedelta_constructor_identity():
# Test for #30543
expected = pd.Timedelta(np.timedelta64(1, "s"))
result = pd.Timedelta(expected)
assert result is expected


def test_timestamp_constructor_identity():
# Test for #30543
expected = pd.Timestamp("2017-01-01T12")
result = pd.Timestamp(expected)
assert result is expected
7 changes: 7 additions & 0 deletions pandas/tests/scalar/timedelta/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,10 @@ def test_td_constructor_on_nanoseconds(constructed_td, conversion):
def test_td_constructor_value_error():
with pytest.raises(TypeError):
Timedelta(nanoseconds="abc")


def test_timedelta_constructor_identity():
# Test for #30543
expected = Timedelta(np.timedelta64(1, "s"))
result = Timedelta(expected)
assert result is expected
Loading