Skip to content

Commit a11463b

Browse files
committed
add failing example for tuple
1 parent d85d995 commit a11463b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pandas/tests/libs/test_hashtable.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,25 @@ def test_nan_complex_imag(self):
219219
table.get_item(other)
220220
assert str(error.value) == str(other)
221221

222+
def test_nan_in_tuple(self):
223+
nan1 = (float("nan"),)
224+
nan2 = (float("nan"),)
225+
assert nan1[0] is not nan2[0]
226+
table = ht.PyObjectHashTable()
227+
table.set_item(nan1, 42)
228+
assert table.get_item(nan2) == 42
229+
230+
def test_nan_in_nested_tuple(self):
231+
nan1 = (1, (2, (float("nan"),)))
232+
nan2 = (1, (2, (float("nan"),)))
233+
other = (1, 2)
234+
table = ht.PyObjectHashTable()
235+
table.set_item(nan1, 42)
236+
assert table.get_item(nan2) == 42
237+
with pytest.raises(KeyError, match=None) as error:
238+
table.get_item(other)
239+
assert str(error.value) == str(other)
240+
222241

223242
def test_get_labels_groupby_for_Int64(writable):
224243
table = ht.Int64HashTable()

0 commit comments

Comments
 (0)