Skip to content

Commit d0b193a

Browse files
committed
adding a test testing explicitly for stability
1 parent e6f7da7 commit d0b193a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/libs/test_hashtable.py

+8
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,14 @@ def test_value_count(self, dtype, type_suffix, writable):
272272
tm.assert_numpy_array_equal(np.sort(keys), expected)
273273
assert np.all(counts == 5)
274274

275+
def test_value_count_stable(self, dtype, type_suffix, writable):
276+
value_count = get_ht_function("value_count", type_suffix)
277+
values = np.array([2, 1, 5, 22, 3, -1, 8]).astype(dtype)
278+
values.flags.writeable = writable
279+
keys, counts = value_count(values, False)
280+
tm.assert_numpy_array_equal(keys, values)
281+
assert np.all(counts == 1)
282+
275283
def test_duplicated_first(self, dtype, type_suffix, writable):
276284
N = 100
277285
duplicated = get_ht_function("duplicated", type_suffix)

0 commit comments

Comments
 (0)