Skip to content

Commit 6a941e5

Browse files
committed
adding empty-corner case test
1 parent cda02f7 commit 6a941e5

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
@@ -139,6 +139,15 @@ def test_tracemalloc_works(self, table_type, dtype):
139139
del table
140140
assert get_allocated_khash_memory() == 0
141141

142+
def test_tracemalloc_for_empty(self, table_type, dtype):
143+
with activated_tracemalloc():
144+
table = table_type()
145+
used = get_allocated_khash_memory()
146+
my_size = table.sizeof()
147+
assert used == my_size
148+
del table
149+
assert get_allocated_khash_memory() == 0
150+
142151

143152
def test_tracemalloc_works_for_StringHashTable():
144153
N = 1000
@@ -153,6 +162,16 @@ def test_tracemalloc_works_for_StringHashTable():
153162
assert get_allocated_khash_memory() == 0
154163

155164

165+
def test_tracemalloc_for_empty_StringHashTable():
166+
with activated_tracemalloc():
167+
table = ht.StringHashTable()
168+
used = get_allocated_khash_memory()
169+
my_size = table.sizeof()
170+
assert used == my_size
171+
del table
172+
assert get_allocated_khash_memory() == 0
173+
174+
156175
@pytest.mark.parametrize(
157176
"table_type, dtype",
158177
[

0 commit comments

Comments
 (0)