MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / __eq__

Method __eq__

bson/son.py:186–192  ·  view source on GitHub ↗

Comparison to another SON is order-sensitive while comparison to a regular dictionary is order-insensitive.

(self, other: Any)

Source from the content-addressed store, hash-verified

184 return default
185
186 def __eq__(self, other: Any) -> bool:
187 """Comparison to another SON is order-sensitive while comparison to a
188 regular dictionary is order-insensitive.
189 """
190 if isinstance(other, SON):
191 return len(self) == len(other) and list(self.items()) == list(other.items())
192 return cast(bool, self.to_dict() == other)
193
194 def __ne__(self, other: Any) -> bool:
195 return not self == other

Callers

nothing calls this directly

Calls 2

to_dictMethod · 0.95
itemsMethod · 0.80

Tested by

no test coverage detected