Skip to content

Comments

Use None instead of NoneType when matching annotations#341

Merged
JacobHayes merged 1 commit intogoldenfrom
none-type
Mar 18, 2023
Merged

Use None instead of NoneType when matching annotations#341
JacobHayes merged 1 commit intogoldenfrom
none-type

Conversation

@JacobHayes
Copy link
Member

Description

Python normally represents None in type hints with the None value, not NoneType. However, the python_type_system would check for isinstance(annotation, NoneType) when matching, which caused some oddness when trying to validate a None value passed to a model. Instead, we now match on None directly.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Updated tests.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in upstream modules

@codecov
Copy link

codecov bot commented Mar 18, 2023

Codecov Report

Merging #341 (dee64c6) into golden (452d006) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            golden      #341   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           43        43           
  Lines         2738      2747    +9     
  Branches       692       696    +4     
=========================================
+ Hits          2738      2747    +9     
Impacted Files Coverage Δ
src/arti/internal/dispatch.py 100.00% <100.00%> (ø)
src/arti/internal/type_hints.py 100.00% <100.00%> (ø)
src/arti/types/python.py 100.00% <100.00%> (ø)
src/arti/views/__init__.py 100.00% <100.00%> (ø)
src/arti/views/python.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@JacobHayes JacobHayes merged commit 8b0863a into golden Mar 18, 2023
@JacobHayes JacobHayes deleted the none-type branch March 18, 2023 23:41
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.

1 participant