mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-19 19:10:17 +00:00
21 lines
349 B
Python
21 lines
349 B
Python
# test basic get/set
|
|
import random
|
|
random.seed(7)
|
|
|
|
a = {str(i): i for i in range(100)}
|
|
a['existed'] = 0
|
|
a['missed'] = 0
|
|
|
|
for i in range(1000000):
|
|
key = str(random.randint(-100, 100))
|
|
if key in a:
|
|
a['existed'] += 1
|
|
else:
|
|
a['missed'] += 1
|
|
|
|
existed = a['existed']
|
|
missed = a['missed']
|
|
|
|
assert abs(existed - missed) < 10000
|
|
|