We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When structuring a bool as an int, the behavior is to convert it to an int:
converter = cattrs.Converter() result = converter.structure(True, int) assert type(result) is int assert result == 1
But when using configure_union_passthrough structuring to a union, it doesn't get converted and remains a bool:
configure_union_passthrough
converter = cattrs.Converter() cattrs.strategies.configure_union_passthrough(Union[int, bool, float, str, None], converter) result = converter.structure(True, Union[int, float]) assert type(result) is bool assert result
My expectation was that it would be converted to an int in both cases.
This is with cattrs 24.1.2.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When structuring a bool as an int, the behavior is to convert it to an int:
But when using
configure_union_passthrough
structuring to a union, it doesn't get converted and remains a bool:My expectation was that it would be converted to an int in both cases.
This is with cattrs 24.1.2.
The text was updated successfully, but these errors were encountered: