Fix ArrayType __eq__ operator so that array types are not duplicated in the registry.
This commit is contained in:
parent
1512c3902f
commit
110db71c8e
@ -318,3 +318,7 @@ class TestTypes(unittest.TestCase):
|
|||||||
|
|
||||||
c = C1(s=six.u('test'))
|
c = C1(s=six.u('test'))
|
||||||
assert c.s == six.u('test')
|
assert c.s == six.u('test')
|
||||||
|
|
||||||
|
def test_array_eq(self):
|
||||||
|
l = [types.ArrayType(str)]
|
||||||
|
assert types.ArrayType(str) in l
|
||||||
|
@ -30,6 +30,9 @@ class ArrayType(object):
|
|||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash(self.item_type)
|
return hash(self.item_type)
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.item_type == other.item_type
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def item_type(self):
|
def item_type(self):
|
||||||
if isinstance(self._item_type, weakref.ref):
|
if isinstance(self._item_type, weakref.ref):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user