-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Invalid Python in test cases #687
Comments
Yeah, this is unfortunate. |
Many of these cases can likely be found using the test data parser used for running test cases and regular expressions. |
I'm looking into this |
Do we want blanket fixes over all tests so that names are only referenced after they are bound? Also, @spkersten, can you point me to your changes that enable mypy to detect this issue? |
I'd define a few separate tests that check for various kinds of forward references (e.g. module, class, function, nested class, type variable, type alias, other kind of variable). Though it's possible that mypy needs to be fixed first to actually error out on them. It's also possible that we should fix the tests without fixing this in mypy (maybe fixing this in mypy is tricky, and of course it must still support forward references from type comments or type annotations in string literals). |
Going by @gvanrossum comment, it seems that we want to make a separate set of tests to test forward references. Therefore I will move forward on my quest to fix all mis-referenced tests I can find |
So right now I'm writing a test suite that tries to |
yup, still open, feel free to work on it. see https://github.com/python/mypy/blob/master/CONTRIBUTING.md#first-time-contributors
|
I think that this was addressed in #14166. |
Many test cases (>100) contain invalid Python code like this,
where a name is referenced before it is bound.
This impedes solving #686.
The text was updated successfully, but these errors were encountered: