I believe this code currently does the unexpected thing:
custom = {}
role = Role([], 1, custom)
custom["customfield"] = "value"
assert "customfield" in role.unrecognized_fields
As in the roles unrecognised fields now does not include "customfield". This is because the initialization self.unrecognized_fields = unrecognized_fields or {} acts surprisingly when the input container is empty. We should check for None instead of falsyness.
Same thing applies throughout the API where unrecognized fields are used.
I believe this code currently does the unexpected thing:
As in the roles unrecognised fields now does not include "customfield". This is because the initialization
self.unrecognized_fields = unrecognized_fields or {}acts surprisingly when the input container is empty. We should check for None instead of falsyness.Same thing applies throughout the API where unrecognized fields are used.