Skip to content

TST: Refactor slow test #53610

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 1 commit into from
Jun 13, 2023
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
8 changes: 3 additions & 5 deletions pandas/tests/test_algos.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,9 @@ def test_objects(self):
assert isinstance(result, np.ndarray)

def test_object_refcount_bug(self):
lst = ["A", "B", "C", "D", "E"]
msg = "unique with argument that is not not a Series"
with tm.assert_produces_warning(FutureWarning, match=msg):
for i in range(1000):
len(algos.unique(lst))
lst = np.array(["A", "B", "C", "D", "E"], dtype=object)
Copy link
Member

Choose a reason for hiding this comment

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

would this still catch the original refcount bug?

im guessing we'd get most of the performance improvement by passing check_stacklevel=False to assert_produces_warning

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah looking back it appears this should have still happened if a numpy array is passed, so I think preemptively changing to address the FutureWarning too is OK

for i in range(1000):
len(algos.unique(lst))

def test_on_index_object(self):
mindex = MultiIndex.from_arrays(
Expand Down