[pypy-svn] r47865 - in pypy/dist/pypy/lang/smalltalk: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Oct 24 23:05:25 CEST 2007


Author: cfbolz
Date: Wed Oct 24 23:05:25 2007
New Revision: 47865

Modified:
   pypy/dist/pypy/lang/smalltalk/model.py
   pypy/dist/pypy/lang/smalltalk/test/test_model.py
Log:
a small integer is its own hash


Modified: pypy/dist/pypy/lang/smalltalk/model.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/model.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/model.py	Wed Oct 24 23:05:25 2007
@@ -22,7 +22,7 @@
         return m_SmallInteger
 
     def gethash(self):
-        return self.value    # XXX check this
+        return self.value
 
     def invariant(self):
         return isinstance(self.value, int)

Modified: pypy/dist/pypy/lang/smalltalk/test/test_model.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/test/test_model.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/test/test_model.py	Wed Oct 24 23:05:25 2007
@@ -62,3 +62,7 @@
     m_class = mockclassmirror(0, m_superclass=m_super)
     m_super.installmethod("foo", model.W_CompiledMethod(0, ""))
     assert m_class.lookup("foo").m_compiledin is m_super
+
+def test_hashes():
+    w_five = W_SmallInteger(5)
+    assert w_five.gethash() == 5



More information about the Pypy-commit mailing list