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

use full name for Attributes #507

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fefe982
Copy link
Contributor

@fefe982 fefe982 commented Jan 15, 2025

Changes

Fixes #506

In assignment check, when attribute is added:

  1. Attribute is only handled in tuple, but not bare attribute assignments. Add check for bare attribute assignment
  2. exp.id is used for Attribute, but for Attribute, it points to the parent object, not the attribute. Changed it to use name ,which is obj.attr, the full path.

Checklist

If this is a user-facing code change, like a bugfix or a new feature, please ensure that
you've fulfilled the following conditions (where applicable):

  • You've added tests (in tests/) added which would fail without your patch
  • You've updated the documentation (in docs/, in case of behavior changes or new
    features)
  • You've added a new changelog entry (in docs/versionhistory.rst).

@coveralls
Copy link

coveralls commented Jan 15, 2025

Coverage Status

coverage: 94.316% (-0.2%) from 94.511%
when pulling e400e02 on fefe982:fix_issue506
into b6a7e43 on agronholm:master.

@fefe982
Copy link
Contributor Author

fefe982 commented Jan 16, 2025

  1. Attribute is only handled in tuple, but not bare attribute assignments. Add check for bare attribute assignment
  2. exp.id is used for Attribute, but for Attribute, it points to the parent object, not the attribute. Changed it to use name ,which is obj.attr, the full path.

The new commit reverted change 2, keeping the annotation of the parent object. Instead, it changed check_variable_assignment, to get the real annotation of the attribute from the parent object. In this way the type of attribute can be correctly checked.

Other changes are due to the pytest does not pass on my Windows machine occasionally, as the path is case insensitive on Windows, and the case changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeCheckError when tuple unpacking to properties of method parameter
2 participants