Skip to content

TST add test case for drop_duplicates #35121

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 5 commits into from
Jul 8, 2020
Merged

Conversation

r-toroxel
Copy link
Contributor

Add a test case to drop_duplicates for inplace=True.

@pep8speaks
Copy link

pep8speaks commented Jul 4, 2020

Hello @r-toroxel! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-07-07 17:55:33 UTC

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

Does this close a particular issue?

@r-toroxel
Copy link
Contributor Author

No.
Its just expanding on test coverage, after looking at pytest-cov and existing tests.

def test_drop_duplicates_inplace_result():
df = DataFrame({"a": [1, 2, 3], "b": [1, 2, 4], "c": [1, 6, 5]})
result = df.drop_duplicates(inplace=True)
assert result is None
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 use assert_frame_equal(df, expected) and construct the expected.

ideally this test goes with other basic drop_duplicates call and we parameterize on inplace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. just checking the return value goes well with the existing
test_drop_duplicates_inplace
moved it there.

@jreback jreback added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Testing pandas testing functions or related to the test suite labels Jul 7, 2020
expected = orig[:2]
result = df
tm.assert_frame_equal(result, expected)
assert(return_value is None)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: You can remove the parenthesis from all of these asserts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thx!

@mroeschke mroeschke added this to the 1.1 milestone Jul 7, 2020
@jreback jreback merged commit 27de044 into pandas-dev:master Jul 8, 2020
@jreback
Copy link
Contributor

jreback commented Jul 8, 2020

thanks @r-toroxel

happy to take PRs to verify other inplace ops return None

@r-toroxel
Copy link
Contributor Author

thanks. yes. created an issue. #35179

@gfyoung gfyoung linked an issue Jul 9, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TST verify inplace ops return None
4 participants