Skip to content

TST: Series construction from ExtensionDtype scalar #37989

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 8 commits into from
Nov 24, 2020
Merged
Changes from 2 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
8 changes: 8 additions & 0 deletions pandas/tests/series/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ def test_scalar_conversion(self):
assert float(Series([1.0])) == 1.0
assert int(Series([1.0])) == 1

@pytest.mark.parametrize("scalar", (Interval(0, 1), Period("2019Q1", freq="Q")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create a fixture of the ea_scalars and use it here: https://github.com/pandas-dev/pandas/blob/master/pandas/tests/frame/test_constructors.py#L738 and in the new test you are adding

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are also similar tests for a dict of a scalar in both series/frame which could be updated to use the fixture as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create a fixture of the ea_scalars and use it here: https://github.com/pandas-dev/pandas/blob/master/pandas/tests/frame/test_constructors.py#L738 and in the new test you are adding

Done

def test_scalar_extension_dtype(self, scalar):
# GH 28401

ser = Series(scalar, index=range(3))
expected = Series([scalar] * 3)
tm.assert_series_equal(ser, expected)

def test_constructor(self, datetime_series):
with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False):
empty_series = Series()
Expand Down