comparison data_schema/__init__.py @ 49:6b8fcd0d2175

Use "==" instaead of "is" when comparing parent schemata. This fixes equality tests of Context instances.
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 03 Aug 2023 02:21:13 +0200
parents a0b464f6ab1f
children 682c32265978
comparison
equal deleted inserted replaced
48:a0b464f6ab1f 49:6b8fcd0d2175
375 return v 375 return v
376 376
377 def __eq__(self, other): 377 def __eq__(self, other):
378 if not isinstance(other, _Schema): 378 if not isinstance(other, _Schema):
379 return NotImplemented 379 return NotImplemented
380 return (self.parent is other.parent 380 return ((self.parent == other.parent)
381 and bool(self.is_sub_root) == bool(other.is_sub_root) 381 and bool(self.is_sub_root) == bool(other.is_sub_root)
382 and dict(self) == dict(other)) 382 and dict(self) == dict(other))
383 383
384 def __ne__(self, other): 384 def __ne__(self, other):
385 # 385 #
493 return ((self._parent == other._parent) 493 return ((self._parent == other._parent)
494 and (self._key == other._key) 494 and (self._key == other._key)
495 and (self._key_index == other._key_index) 495 and (self._key_index == other._key_index)
496 # XXX FIXME ??? 496 # XXX FIXME ???
497 # and (self.root_object == other.root_object) 497 # and (self.root_object == other.root_object)
498 # and (self.root_schema == other.root_schema) 498 and (self.root_schema == other.root_schema)
499 # and (self._current_object == other._current_object) 499 # and (self._current_object == other._current_object)
500 and (self._settings == other._settings) 500 and (self._settings == other._settings)
501 ) 501 )
502 502
503 def __ne__(self, other): 503 def __ne__(self, other):