Skip to content
Merged
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
24 changes: 4 additions & 20 deletions pandas/tests/series/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1579,11 +1579,11 @@ def test_convert_non_ns(self):
tm.assert_series_equal(ser, expected)

# try to construct from a sequence asking for non-ns timedelta64
with pytest.raises(TypeError, match=r"Only \[ns\] granularity"):
with pytest.raises(TypeError, match=r"Only \[ns\] granularity is supported"):
Series([1000000, 200000, 3000000], dtype="timedelta64[s]")

# try to construct from a sequence asking for non-ns datetime64
with pytest.raises(TypeError, match=r"Only \[ns\] granularity"):
with pytest.raises(TypeError, match=r"Only \[ns\] granularity is supported"):
Series([1000000, 200000, 3000000], dtype="datetime64[s]")

@pytest.mark.parametrize(
Expand Down Expand Up @@ -1650,8 +1650,8 @@ def test_constructor_generic_timestamp_no_frequency(self, dtype, request):
@pytest.mark.parametrize(
"dtype,msg",
[
("m8[ps]", "cannot convert timedeltalike"),
("M8[ps]", "cannot convert datetimelike"),
("m8[ps]", "Only \[ns\] granularity is supported"),
("M8[ps]", "Only \[ns\] granularity is supported"),
],
)
def test_constructor_generic_timestamp_bad_frequency(self, dtype, msg):
Expand Down Expand Up @@ -1894,22 +1894,6 @@ def test_constructor_dtype_timedelta_alternative_construct(self):
expected = Series(pd.to_timedelta([1000000, 200000, 3000000], unit="ns"))
tm.assert_series_equal(result, expected)

def test_constructor_dtype_timedelta_ns_s(self):
# GH#35465
result = Series([1000000, 200000, 3000000], dtype="timedelta64[ns]")
expected = Series([1000000, 200000, 3000000], dtype="timedelta64[s]")
tm.assert_series_equal(result, expected)

def test_constructor_dtype_timedelta_ns_s_astype_int64(self):
# GH#35465
result = Series([1000000, 200000, 3000000], dtype="timedelta64[ns]").astype(
"int64"
)
expected = Series([1000000, 200000, 3000000], dtype="timedelta64[s]").astype(
"int64"
)
tm.assert_series_equal(result, expected)

@pytest.mark.filterwarnings(
"ignore:elementwise comparison failed:DeprecationWarning"
)
Expand Down