mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-04 08:02:34 +03:00
Added code submitted by Andreas Pakulat to provide node equality,
* python/libxml.c, python/libxml.py, python/tests/compareNodes.py, python/tests/Makefile.am: Added code submitted by Andreas Pakulat to provide node equality, inequality and hash functions, plus a single test program to check the functions (bugs 345779 + 345961).
This commit is contained in:
@ -232,6 +232,23 @@ class xmlCore:
|
||||
self._o = _obj;
|
||||
return
|
||||
self._o = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if other == None:
|
||||
return False
|
||||
ret = libxml2mod.compareNodesEqual(self._o, other._o)
|
||||
if ret == None:
|
||||
return False
|
||||
return ret == True
|
||||
def __ne__(self, other):
|
||||
if other == None:
|
||||
return True
|
||||
ret = libxml2mod.compareNodesEqual(self._o, other._o)
|
||||
return not ret
|
||||
def __hash__(self):
|
||||
ret = libxml2mod.nodeHash(self._o)
|
||||
return ret
|
||||
|
||||
def __str__(self):
|
||||
return self.serialize()
|
||||
def get_parent(self):
|
||||
|
Reference in New Issue
Block a user