Skip to content

Commit 55f75dc

Browse files
committed
remove unsupported tests and fix rised error
1 parent ffc70e3 commit 55f75dc

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

pandas/tests/series/test_constructors.py

+4-20
Original file line numberDiff line numberDiff line change
@@ -1579,11 +1579,11 @@ def test_convert_non_ns(self):
15791579
tm.assert_series_equal(ser, expected)
15801580

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

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

15891589
@pytest.mark.parametrize(
@@ -1650,8 +1650,8 @@ def test_constructor_generic_timestamp_no_frequency(self, dtype, request):
16501650
@pytest.mark.parametrize(
16511651
"dtype,msg",
16521652
[
1653-
("m8[ps]", "cannot convert timedeltalike"),
1654-
("M8[ps]", "cannot convert datetimelike"),
1653+
("m8[ps]", "Only \[ns\] granularity is supported"),
1654+
("M8[ps]", "Only \[ns\] granularity is supported"),
16551655
],
16561656
)
16571657
def test_constructor_generic_timestamp_bad_frequency(self, dtype, msg):
@@ -1894,22 +1894,6 @@ def test_constructor_dtype_timedelta_alternative_construct(self):
18941894
expected = Series(pd.to_timedelta([1000000, 200000, 3000000], unit="ns"))
18951895
tm.assert_series_equal(result, expected)
18961896

1897-
def test_constructor_dtype_timedelta_ns_s(self):
1898-
# GH#35465
1899-
result = Series([1000000, 200000, 3000000], dtype="timedelta64[ns]")
1900-
expected = Series([1000000, 200000, 3000000], dtype="timedelta64[s]")
1901-
tm.assert_series_equal(result, expected)
1902-
1903-
def test_constructor_dtype_timedelta_ns_s_astype_int64(self):
1904-
# GH#35465
1905-
result = Series([1000000, 200000, 3000000], dtype="timedelta64[ns]").astype(
1906-
"int64"
1907-
)
1908-
expected = Series([1000000, 200000, 3000000], dtype="timedelta64[s]").astype(
1909-
"int64"
1910-
)
1911-
tm.assert_series_equal(result, expected)
1912-
19131897
@pytest.mark.filterwarnings(
19141898
"ignore:elementwise comparison failed:DeprecationWarning"
19151899
)

0 commit comments

Comments
 (0)