Skip to content

Commit 62511e6

Browse files
committed
adding breaking example with complex
1 parent 017ff7c commit 62511e6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pandas/tests/libs/test_hashtable.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,24 @@ def test_no_reallocation(self, table_type, dtype):
178178
assert n_buckets_start == clean_table.get_state()["n_buckets"]
179179

180180

181+
class TestPyObjectHashTableWithNans:
182+
def test_nan_float(self):
183+
nan1 = float("nan")
184+
nan2 = float("nan")
185+
assert nan1 is not nan2
186+
table = ht.PyObjectHashTable()
187+
table.set_item(nan1, 42)
188+
assert table.get_item(nan2) == 42
189+
190+
def test_nan_complex(self):
191+
nan1 = 1j * float("nan")
192+
nan2 = 1j * float("nan")
193+
assert nan1 is not nan2
194+
table = ht.PyObjectHashTable()
195+
table.set_item(nan1, 42)
196+
assert table.get_item(nan2) == 42
197+
198+
181199
def test_get_labels_groupby_for_Int64(writable):
182200
table = ht.Int64HashTable()
183201
vals = np.array([1, 2, -1, 2, 1, -1], dtype=np.int64)

0 commit comments

Comments
 (0)