From c452ea3f9375f0d40a44fd60cfffddae7ed995b8 Mon Sep 17 00:00:00 2001 From: tess <48131946+stress-tess@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:43:31 -0400 Subject: [PATCH] Closes #3677: Occasional failures of test_string_broadcast (#3678) This PR fixes #3677 by regenerating `keys` if not all elements appear at least once Co-authored-by: Tess Hayes --- tests/string_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/string_test.py b/tests/string_test.py index 50236609f0..b04ea0067a 100644 --- a/tests/string_test.py +++ b/tests/string_test.py @@ -877,6 +877,10 @@ def test_inferred_type(self): def test_string_broadcast(self): keys = ak.randint(0, 10, 100, int) + while ak.unique(keys).size != 10: + # keep generating until every element appears at least once + keys = ak.randint(0, 10, 100, int) + g = ak.GroupBy(keys) str_vals = ak.random_strings_uniform(0, 3, 10, characters="printable") str_broadcast_ans = str_vals[keys]