[pypy-svn] r33038 - in pypy/dist/pypy/rpython/ootypesystem: . test
antocuni at codespeak.net
antocuni at codespeak.net
Mon Oct 9 11:09:00 CEST 2006
Author: antocuni
Date: Mon Oct 9 11:08:59 2006
New Revision: 33038
Modified:
pypy/dist/pypy/rpython/ootypesystem/ootype.py
pypy/dist/pypy/rpython/ootypesystem/test/test_oorecord.py
Log:
We don't want ootype._record of differents types to compare equal.
Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py Mon Oct 9 11:08:59 2006
@@ -1169,7 +1169,7 @@
return hash(key)
def __eq__(self, other):
- return self._items == other._items
+ return self._TYPE == other._TYPE and self._items == other._items
def __ne__(self, other):
return not (self == other)
Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oorecord.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oorecord.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oorecord.py Mon Oct 9 11:08:59 2006
@@ -9,6 +9,19 @@
assert T2 != T3
assert hash(T) == hash(T2)
+def test_value_comparison():
+ T = Record({"a": Signed, "b": Signed})
+ T2 = Record({"a": Signed, "b": Float})
+
+ t = new(T)
+ t.a = 0
+ t.b = 0
+ t2 = new(T2)
+ t.a = 0
+ t.b = 0.0
+ assert T != T2
+ assert t != t2
+
def test_new():
T = Record({"a": Signed, "b": Signed})
t = new(T)
More information about the pypy-svn
mailing list