tests/stress: Add test to create a dict beyond "maximum" rehash size.
There is a finite list of ascending primes used for the size of a hash table, and this test tests that the code can handle a dict larger than the maximum value in that list of primes. Adding this tests gets py/map.c to 100% coverage.
This commit is contained in:
parent
90da791a08
commit
77a62d8b5a
13
tests/stress/dict_create_max.py
Normal file
13
tests/stress/dict_create_max.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# The aim with this test is to hit the maximum resize/rehash size of a dict,
|
||||||
|
# where there are no more primes in the table of growing allocation sizes.
|
||||||
|
# This value is 54907 items.
|
||||||
|
|
||||||
|
d = {}
|
||||||
|
try:
|
||||||
|
for i in range(54908):
|
||||||
|
d[i] = i
|
||||||
|
except MemoryError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Just check the dict still has the first value
|
||||||
|
print(d[0])
|
Loading…
Reference in New Issue
Block a user