Skip to content

unrecognised_fields default value vs empty container #1937

@jku

Description

@jku

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issueBite-sized items for first time contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions