Fixed flaky test_optional by using seed and larger sample size.#2376
Merged
fcurella merged 2 commits intoJun 8, 2026
Conversation
Contributor
|
linting is now fixed - if you make a merge commit or similar minor update then the ci should run normally |
Seeding made the test deterministic against a fixed sequence rather than verifying probabilistic coverage. 100 draws reduce failure probability to < 0.000003% without relying on a specific seed. Trims the 3-line comment to a single reference line. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Done! thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2366.
test_optionaldrew only 10 samples from a probabilistic generator and asserted that all three outcomes (True,False,None) appeared. With the default probability split, the empirical failure rate was ~12% per run (confirmed by 5000-run Monte Carlo in the issue report).Fix:
Faker.seed(0)for determinism.No behaviour change — only the test is affected.