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
def __eq__(self, other):
if not isinstance(other, BaseLDAPEntry):
return NotImplemented
if self.dn != other.dn:
return 0
my = self.keys()
my.sort()
its = other.keys()
its.sort()
if my != its:
return 0
for key in my:
myAttr = self[key]
itsAttr = other[key]
if myAttr != itsAttr:
return 0
return 1
while hash as
def __hash__(self):
return hash(self.dn)
I think that this is wrong is it can lead to objects with same hash but which are not equal.
The text was updated successfully, but these errors were encountered:
def testEquality(self):
"""
They are equal as they have the same DN and same attributes and
values.
"""
def testHashEquality(self):
"""
Objects which are equal have the same hash.
"""
def testHashInequalityEquality(self):
"""
Objects which are not equal have different hash,
even if the have the same DN (but different attributes).
"""
def testInequalityWithSameType(self):
"""
Instances for different DN are not equal.
"""
def testInequalityWithOtherTypes(self):
"""
Instances are not equal to other types.
"""
Equality is implemented as
while hash as
I think that this is wrong is it can lead to objects with same hash but which are not equal.
The text was updated successfully, but these errors were encountered: