Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate alphabet strategies #3505

Merged
merged 4 commits into from Nov 14, 2022
Merged

Conversation

Zac-HD
Copy link
Member

@Zac-HD Zac-HD commented Nov 12, 2022

Closes #3503; also fixes #3500 and fixes #3504.

@Zac-HD Zac-HD requested a review from honno November 12, 2022 06:27
I couldn't actually reproduce the reported error, but if you did happen to get tb=None that would cause the reported problem and this patch would fix it.
Copy link
Member

@honno honno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Work on array_api.py things and handling multi-char alphabet strategies looks great!

Fix for escalation.py works, however on my end this reveals a new problem when using Aaron's #3504 reproducer (with numpy==1.23.0).

$ pytest test.py
...
exception = IndexError('index 0 is out of bounds for axis 0 with size 0')

    def get_interesting_origin(exception):
        # The `interesting_origin` is how Hypothesis distinguishes between multiple
        # failures, for reporting and also to replay from the example database (even
        # if report_multiple_bugs=False).  We traditionally use the exception type and
        # location, but have extracted this logic in order to see through `except ...:`
        # blocks and understand the __cause__ (`raise x from y`) or __context__ that
        # first raised an exception as well as PEP-654 exception groups.
        tb = get_trimmed_traceback(exception)
>       filename, lineno, *_ = traceback.extract_tb(tb)[-1]
E       IndexError: list index out of range
...
FAILED test.py::test - IndexError: list index out of range

Looks to be a similar problem as before, where we aren't handling tb=None and therefore len(traceback.extract_tb(tb))=0.

filename, lineno, *_ = traceback.extract_tb(tb)[-1]

@Zac-HD
Copy link
Member Author

Zac-HD commented Nov 14, 2022

🤦‍♂️ ah, yep, I just had a too-old version of Numpy in my venv. Fixing that made the repro work; and now we have a complete fix and corresponding test.

@Zac-HD Zac-HD merged commit 1f6bdc3 into HypothesisWorks:master Nov 14, 2022
@Zac-HD Zac-HD deleted the validate-alphabet branch November 14, 2022 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants