Whole file
mrmaxguns/wonderwordsmodule
The author described this change as “fix: critical bug with return_less_if_necessary”. It counts as a record because the check below fails on the code as it stood at d22b07b07 and passes on 7741fd2e9, with nothing else changed between the two runs.
Projectmrmaxguns/wonderwordsmodule
Fix saved2024-04-10
Sharing licenceMIT · LICENSE
Change size+9 −8
What the code was meant to do, written into the code itself as a save note
fix: critical bug with return_less_if_necessary
The change
| 391 | 391 | exclude_with_spaces=exclude_with_spaces, | |
| 392 | 392 | ) | |
| 393 | 393 | ||
| 394 | - | if not return_less_if_necessary and len(choose_from) < amount: | |
| 395 | - | raise NoWordsToChoseFrom( | |
| 396 | - | "There aren't enough words to choose from. Cannot generate " | |
| 397 | - | f"{str(amount)} word(s)" | |
| 398 | - | ) | |
| 399 | - | elif return_less_if_necessary: | |
| 400 | - | random.shuffle(choose_from) | |
| 401 | - | return choose_from | |
| 394 | + | if len(choose_from) < amount: | |
| 395 | + | if return_less_if_necessary: | |
| 396 | + | random.shuffle(choose_from) | |
| 397 | + | return choose_from | |
| 398 | + | else: | |
| 399 | + | raise NoWordsToChoseFrom( | |
| 400 | + | "There aren't enough words to choose from. Cannot generate " | |
| 401 | + | f"{str(amount)} word(s)" | |
| 402 | + | ) | |
| 402 | 403 | ||
| 403 | 404 | words = [] | |
| 404 | 405 | for _ in range(amount): |
The check that tells the two apart
fail→pass·tests/test_random_word.py::TestRandomWord::test_random_words_enough_with_return_less_if_necessary
Check file tests/test_random_word.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itd22b07b0775dff5bede712cee82b951765721098
Broken version dated2024-04-10
Modulewonderwords.random_word
Units changedRandomWord
Fingerprinte3c17cc206acae28
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.