-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
TST: Adding test to concat where copy=False for ExtensionArrays #30625
Conversation
The test ensures that ExtensionArrays are correctly constructed when concat(copy=False) is used.
pandas/tests/reshape/test_concat.py
Outdated
@@ -2730,3 +2730,25 @@ def test_concat_datetimeindex_freq(): | |||
expected = pd.DataFrame(data[50:] + data[:50], index=dr[50:].append(dr[:50])) | |||
expected.index._data.freq = None | |||
tm.assert_frame_equal(result, expected) | |||
|
|||
|
|||
def test_concat_copy_false_extension_array(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be add to the class at pandas.tests.extension.base.reshaping.BaseReshapingTests
.
It'll need to be restructured a bit to not refer to decimal specifically. It needs to work with the data provided by the fixture. See the other concat there for examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM. Moved the test to pandas.tests.extension.base.reshaping.BaseReshapingTests
and updated the test to use the data provided by the fixture. I also simplified the test to make it more clear.
Also simplifying the test case to make it more understandable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, small change. ping on green.
@@ -94,6 +94,19 @@ def test_concat_columns(self, data, na_value): | |||
result = pd.concat([df1["A"], df2["B"]], axis=1) | |||
self.assert_frame_equal(result, expected) | |||
|
|||
# non-aligned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this into a new test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Per the feedback from PR pandas-dev#30625
thanks @dwhu |
The test ensures that ExtensionArrays are correctly constructed when
concat(copy=False) is used.
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff