ramonhagenaars / jsons

🐍 A Python lib for (de)serializing Python objects to/from JSON
https://jsons.readthedocs.io
MIT License
289 stars 41 forks source link

Fix issues with delayed annotations and named tuple #154

Closed georgeharker closed 2 years ago

georgeharker commented 2 years ago

Previously named tuple would see ForwardDeclaration(T) for the named types because it didn't use get_type_hints to grab __annotations__. This PR resolves that issue so that when from __future__ import annotations is used (or a later python version) the annotations resolve correctly.

georgeharker commented 2 years ago

note - also patched the disable of tests on macOS, which I don't actually want in this PR - but wanted to verify the rest of the tests.

codecov-commenter commented 2 years ago

Codecov Report

Merging #154 (ecb7f10) into Release/1.6.1 (b74231c) will decrease coverage by 0.33%. The diff coverage is 100.00%.

:exclamation: Current head ecb7f10 differs from pull request most recent head 3ad7736. Consider uploading reports for the commit 3ad7736 to get more accurate results Impacted file tree graph

@@                Coverage Diff                @@
##           Release/1.6.1     #154      +/-   ##
=================================================
- Coverage          99.39%   99.06%   -0.34%     
=================================================
  Files                 60       60              
  Lines               1491     1491              
=================================================
- Hits                1482     1477       -5     
- Misses                 9       14       +5     
Impacted Files Coverage Ξ”
jsons/deserializers/default_tuple.py 100.00% <100.00%> (ΓΈ)
jsons/_compatibility_impl.py 92.00% <0.00%> (-8.00%) :arrow_down:
jsons/serializers/default_primitive.py 94.73% <0.00%> (-5.27%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update b74231c...3ad7736. Read the comment docs.

ramonhagenaars commented 2 years ago

Thanks a lot, @georgeharker for another pull request! πŸ˜ƒ I gladly incorporate this into the next release, which is basically your release now. πŸ˜„

note - also patched the disable of tests on macOS, which I don't actually want in this PR - but wanted to verify the rest of the tests.

Yes, for some reason Github Actions fails to setup a Python environment on MacOS. Definately out of scope for your pull request.

Same with the coverage: I need to look into combining the reports for several operating systems... Also out of scope for now.