Skip to content

Commit

Permalink
Closes Bears-R-Us#3677: Occasional failures of test_string_broadcast (B…
Browse files Browse the repository at this point in the history
…ears-R-Us#3678)

This PR fixes Bears-R-Us#3677 by regenerating `keys` if not all elements appear at least once

Co-authored-by: Tess Hayes <stress-tess@users.noreply.github.com>
  • Loading branch information
stress-tess and stress-tess committed Aug 19, 2024
1 parent d0db02f commit c452ea3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/string_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit c452ea3

Please sign in to comment.