dapper91 / pydantic-xml

python xml for humans
https://pydantic-xml.readthedocs.io
The Unlicense
155 stars 16 forks source link

Add tests for union of models which are similar #80

Closed GuillaumeDesforges closed 1 year ago

GuillaumeDesforges commented 1 year ago

In context of Union type the decision which deserializer to use is based on the actual field type, which in turn derived using pydantic parse_obj. So if pydantic choose a wrong field type on serialization, a wrong deserializer is chosen on deserialization.

The solution is to switch on smart_union flag for such models

See related issue: https://github.com/dapper91/pydantic-xml/issues/72

codecov-commenter commented 1 year ago

Codecov Report

Merging #80 (2d415d9) into master (8d83744) will decrease coverage by 0.02%. The diff coverage is n/a.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master      #80      +/-   ##
==========================================
- Coverage   93.13%   93.11%   -0.02%     
==========================================
  Files          23       23              
  Lines        1092     1090       -2     
==========================================
- Hits         1017     1015       -2     
  Misses         75       75              
Flag Coverage Δ
unittests 93.11% <ø> (-0.02%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

see 3 files with indirect coverage changes

GuillaumeDesforges commented 1 year ago

I have no bandwidth to shepherd this unfortunately.