-
Notifications
You must be signed in to change notification settings - Fork 189
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
Allow generator expressions in f-strings #419
Conversation
I don't think we have great coverage for what's allowed in f-strings. Assuming hypothesmith does not help here, any ideas for getting more variety? |
@thatch , out large scale codebase is a good dataset to test f-string variety, I believe that's how @zsol identified #388 and #387 f-string issues. Whenever we find new cases not supported, we should include the found cases as test cases. |
Yes, but written by humans it tends to not include a lot of edge cases. I wrote up a quick script that just tries random tokens; it identified two issues in under a minute. One is generator expressions, the other is (I did try Hypothesmith, but it wasn't generating any expressions with spaces in them even with bumping deadline and max_examples, so I switched to just doing the straightforward thing.) Are you comfortable approving based off that testing? |
I am :) but I won't have time to look through the changes today. ETA Monday |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Zac-HD do you know if generating expression in f-string is supported in Hypothesmith? |
More generally Hypothesmith does still deserve the |
@Zac-HD I trivially modified the expr example, and it looks like it never generated an expression with any whitespace. This is before the https://gist.github.com/thatch/2b0b13e50eb181f0fe0459ead810f518 |
I'd recommend using the |
Fixes #388
Summary
I'm kind of dogsciencing this, since there doesn't appear to be a formal grammar for f-strings. I tested a few other languages features and am pretty confident the only major feature that works in 3.8 that we didn't have was bare generator expressions.
Test Plan
Includes new test, also tested on John's longer example.