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

Fix the check for None type in inspect._get_parser #96

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

jdidion
Copy link
Contributor

@jdidion jdidion commented Feb 22, 2024

type(type(None)) returns <class type>, and so isinstance(type_, type(type(None))) always returns True. Instead, we want type_ is type(None). I used @msto suggestion to alias NoneType = type(None) to avoid the flake8 E721 error.

Closes #94.

@jdidion jdidion requested review from msto and TedBrookings February 22, 2024 16:41
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (94b3696) 93.34% compared to head (990d303) 93.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
+ Coverage   93.34%   93.68%   +0.34%     
==========================================
  Files          32       32              
  Lines        3364     3374      +10     
  Branches      619      622       +3     
==========================================
+ Hits         3140     3161      +21     
+ Misses        149      140       -9     
+ Partials       75       73       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@TedBrookings TedBrookings left a comment

Choose a reason for hiding this comment

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

The types and inspect modules are quite complex and the fact that this weird edge-case resulted in incorrect behavior suggests to me that many more tests are needed. But that's a separate issue. I think this PR correctly addresses the issue at hand.

@jdidion jdidion merged commit bd2b283 into main Feb 22, 2024
9 checks passed
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.

from_attr returns a none_parser rather than throw ParserNotFound
2 participants