Skip to content

Commit 5110e5d

Browse files
committed
test more corner cases in the allocator acquire/release code
1 parent 5718197 commit 5110e5d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

stringdtype/tests/test_stringdtype.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,17 +811,25 @@ def func(arr):
811811
rnd = rng.random()
812812
# either write to random locations in the array, compute a ufunc, or
813813
# re-initialize the array
814-
if rnd < 0.3333:
814+
if rnd < 0.25:
815815
num = np.random.randint(0, arr.size)
816816
arr[num] = arr[num] + "hello"
817-
elif rnd < 0.6666:
818-
np.add(arr, arr)
817+
elif rnd < 0.5:
818+
if rnd < 0.375:
819+
np.add(arr, arr)
820+
else:
821+
np.add(arr, arr, out=arr)
822+
elif rnd < 0.75:
823+
if rnd < 0.875:
824+
np.multiply(arr, np.int64(2))
825+
else:
826+
np.multiply(arr, np.int64(2), out=arr)
819827
else:
820828
arr[:] = random_string_list
821829

822830
with concurrent.futures.ThreadPoolExecutor(max_workers=8) as tpe:
823831
arr = np.array(random_string_list, dtype=dtype)
824-
futures = [tpe.submit(func, arr) for _ in range(100)]
832+
futures = [tpe.submit(func, arr) for _ in range(500)]
825833

826834
for f in futures:
827835
f.result()

0 commit comments

Comments
 (0)