Skip to content

Commit

Permalink
Added test for #45929 and removed superfluous single_cpu mark
Browse files Browse the repository at this point in the history
The `single_cpu` attribute for `test_unique_bad_unicode` was likely an attempt to cover over the underlying bug fixed with this commit.  We can now run this test in the usual fashion.

Added a test case for the problem reported in 45929.

Signed-off-by: Michael Tiemann <[email protected]>
  • Loading branch information
MichaelTiemannOSC committed Oct 15, 2023
1 parent c300b46 commit b4157f0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pandas/tests/base/test_unique.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def test_nunique_null(null_obj, index_or_series_obj):
assert obj.nunique(dropna=False) == max(0, num_unique_values)


@pytest.mark.single_cpu
def test_unique_bad_unicode(index_or_series):
# regression test for #34550
uval = "\ud83d" # smiley emoji
Expand All @@ -113,6 +112,24 @@ def test_unique_bad_unicode(index_or_series):
tm.assert_numpy_array_equal(result, expected)


def test_unique_45929(index_or_series):
# regression test for #45929
data_list = [
"1 \udcd6a NY",
"2 \udcd6b NY",
"3 \ud800c NY",
"4 \udcd6d NY",
"5 \udcc3e NY",
]

obj = index_or_series(data_list)
assert len(obj.unique()) == len(data_list)
assert len(obj.value_counts()) == len(data_list)
assert len(np.unique(data_list)) == len(data_list)
assert len(set(data_list)) == len(data_list)
assert obj.is_unique


@pytest.mark.parametrize("dropna", [True, False])
def test_nunique_dropna(dropna):
# GH37566
Expand Down

0 comments on commit b4157f0

Please sign in to comment.