-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Inconsistent Application of serialization_strategy #93
Comments
This appears to be happening because |
… the same type.
Using a decorator @lru_cache()
@typing.no_type_check
def __get_serialization_strategy(self, ftype: typing.Type) -> typing.Optional[SerializationStrategyValueType] I can return back to coding next week when my vacation ended. You can prepare your existing PR or let me fix this issue myself. Anyway thank you for spotting this bug and I hope it didn’t do anything bad in your production code. |
@peterallenwebb I decided to accept your PR instead of relying on the type objects to always be hashable. Thank you for your contribution! |
Fixed in 3.3.1. |
Description
There is an apparent regression in serialization behavior when the serialization_strategy object is being used and there are multiple properties of the same type on the class being serialized. It worked as I expected in 3.1.1, but fails in 3.2 and 3.3.
If the existing unit test
test_config.test_serialization_strategy
is modified to include a third property calledc
of typestr
, it will fail to properly deserializec
. Here's what the modified test looks like in full:It appears to fail because the custom serialize/deserialize methods are called for b, but not for c.
AssertionError: assert test_serialization_strategy.<locals>.DataClass(a=123, b='abc', c=['abc']) == test_serialization_strategy.<locals>.DataClass(a=123, b='abc', c='abc')
The text was updated successfully, but these errors were encountered: