You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Yeah, I feel like this is a tough one. Like we talked about: configurator should arguably strip off the ConfigNode wrapper at assignment time, but there will likely be cases where this doesn't work (assigning a dict mapping to ConfigNodes, etc).
I feel like the answer might want to be "you should be using the mapping/merging APIs" but want to leave this open for the next time I have a proper chance to play with this project...
cjw296
changed the title
Value-based equality comparisons
Assignments should strip off any ConfigNode wrappers.
Dec 12, 2022
I noticed that
Config.__eq__
isn't implemented so we just getobject.__eq__
comparison (identity based)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 ofConfigNode
, 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
orConfigNode
instance directly.The text was updated successfully, but these errors were encountered: