Skip to content

Assignments should strip off any ConfigNode wrappers. #15

@wimglenn

Description

@wimglenn

I noticed that Config.__eq__ isn't implemented so we just get object.__eq__ comparison (identity based)

>>> from configurator import Config
>>> c1 = Config({"k": "v"})
>>> c2 = Config({"k": "v"})
>>> c1 == c2
False

Would it be possible to get a content-based equality comparison? In the simple example above we could just use c1.data == c2.data, but my real use-case has a nested configuration so comparing data attributes doesn't work either: the nested values are instances of ConfigNode, which also has identity-based comparison.

My use-case is in testing comparisons, where we want to assert some configs from multiple sources have been parsed and layered the way we expected, without having to recursively extract all the content from the Config instance. i.e., just compare with an "expected" Config or ConfigNode instance directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions