Author: Lukas Diekmann <[email protected]>
Branch: 
Changeset: r44435:e8b21691c24e
Date: 2011-02-03 13:54 +0100
http://bitbucket.org/pypy/pypy/changeset/e8b21691c24e/

Log:    Added test to better understand relationship between
        W_SmallTupleObject and W_TupleObject

diff --git a/pypy/objspace/std/test/test_smalltupleobject.py 
b/pypy/objspace/std/test/test_smalltupleobject.py
--- a/pypy/objspace/std/test/test_smalltupleobject.py
+++ b/pypy/objspace/std/test/test_smalltupleobject.py
@@ -1,3 +1,4 @@
+from pypy.objspace.std.tupleobject import W_TupleObject
 from pypy.objspace.std.smalltupleobject import W_SmallTupleObject
 from pypy.interpreter.error import OperationError
 from pypy.objspace.std.test.test_tupleobject import AppTestW_TupleObject
@@ -56,3 +57,16 @@
     def test_issmalltupleobject(self):
         w_tuple = self.space.newtuple([self.space.wrap(1), self.space.wrap(2)])
         assert isinstance(w_tuple, W_SmallTupleObject)
+
+    def test_hash_agains_normal_tuple(self):
+        normalspace = gettestobjspace(**{"objspace.std.withsmalltuple": False})
+        w_tuple = normalspace.newtuple([self.space.wrap(1), 
self.space.wrap(2)])
+
+        smallspace = gettestobjspace(**{"objspace.std.withsmalltuple": True})
+        w_smalltuple = smallspace.newtuple([self.space.wrap(1), 
self.space.wrap(2)])
+
+        assert isinstance(w_smalltuple, W_SmallTupleObject)
+        assert isinstance(w_tuple, W_TupleObject)
+        assert not normalspace.is_true(normalspace.eq(w_tuple, w_smalltuple))
+        assert smallspace.is_true(smallspace.eq(w_tuple, w_smalltuple))
+        assert smallspace.is_true(smallspace.eq(normalspace.hash(w_tuple), 
smallspace.hash(w_smalltuple)))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to