-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add tests for crash on inference of __len__
#5269
Conversation
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.
Thank you !
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.
Not sure this is needed anymore as the test cases I suggested in pylint-dev/astroid#1234 (review) should cover it.
Closing in favour of tests in pylint-dev/astroid#1234. |
I think adding regression tests in pylint is a nice way to close the pylint issue when the problem is really fixed, right now pylint #5244 is closed but astroid is not upgraded in pylint to 2.8.5 yet so the issue will persist if we release pylint 2.12.0 without upgrading to astroid 2.8.5 first. The cost of running the test in pylint is not very high too. |
I have reopened the PR although the names shall have to be updated ( |
Tests have been renamed. Did not add a changelog entry as that really felt unwarranted since 1) the change is really in |
Pull Request Test Coverage Report for Build 1453677129
💛 - Coveralls |
def __len__(self): | ||
"""Initially reported crash crashed on this function def""" | ||
return len(self.array) |
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.
This doesn't test anything anymore. Apparent as all tests pass without the fix.
Either revert the module name change or use the example for the code review (with lambda
). This can even be added as a normal functional test as it doesn't depend on the module name.
class MyClass:
def some_func(self):
return lambda: 42
def __len__(self):
return len(self.some_func())
Updated to actually crash (and be resolved by |
I just released astroid 2.8.5, would you mind upgrading the version in this PR as it's the one that needs it ? :) |
Ah misunderstood you. Added a preceding commit that bumps the version :) |
The test were not passing in the latest commit before upgrading to astroid 2.8.5
doc/whatsnew/<current release.rst>
.-->
Type of Changes
Description
These are the tests for pylint-dev/astroid#1234
This closes #5244