From 5110e5d6d1f28be133108033836ba5d79f31d591 Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Mon, 20 Nov 2023 11:24:59 -0700 Subject: [PATCH] test more corner cases in the allocator acquire/release code --- stringdtype/tests/test_stringdtype.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/stringdtype/tests/test_stringdtype.py b/stringdtype/tests/test_stringdtype.py index 2630ed31..e1cc27a0 100644 --- a/stringdtype/tests/test_stringdtype.py +++ b/stringdtype/tests/test_stringdtype.py @@ -811,17 +811,25 @@ def func(arr): rnd = rng.random() # either write to random locations in the array, compute a ufunc, or # re-initialize the array - if rnd < 0.3333: + if rnd < 0.25: num = np.random.randint(0, arr.size) arr[num] = arr[num] + "hello" - elif rnd < 0.6666: - np.add(arr, arr) + elif rnd < 0.5: + if rnd < 0.375: + np.add(arr, arr) + else: + np.add(arr, arr, out=arr) + elif rnd < 0.75: + if rnd < 0.875: + np.multiply(arr, np.int64(2)) + else: + np.multiply(arr, np.int64(2), out=arr) else: arr[:] = random_string_list with concurrent.futures.ThreadPoolExecutor(max_workers=8) as tpe: arr = np.array(random_string_list, dtype=dtype) - futures = [tpe.submit(func, arr) for _ in range(100)] + futures = [tpe.submit(func, arr) for _ in range(500)] for f in futures: f.result()