[pypy-commit] pypy kill-single-impl-multimethods: As impossible as it sounds, there don't see to be tests for dict.__contains__

alex_gaynor noreply at buildbot.pypy.org
Mon Aug 8 01:52:53 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: kill-single-impl-multimethods
Changeset: r46359:13fcc37c343d
Date: 2011-08-07 16:54 -0700
http://bitbucket.org/pypy/pypy/changeset/13fcc37c343d/

Log:	As impossible as it sounds, there don't see to be tests for
	dict.__contains__

diff --git a/pypy/objspace/std/dicttype.py b/pypy/objspace/std/dicttype.py
--- a/pypy/objspace/std/dicttype.py
+++ b/pypy/objspace/std/dicttype.py
@@ -984,6 +984,7 @@
     __getitem__ = gateway.interp2app(W_DictMultiObject.descr__getitem__),
     __setitem__ = gateway.interp2app(W_DictMultiObject.descr__setitem__),
     __delitem__ = gateway.interp2app(W_DictMultiObject.descr__delitem__),
+    __contains__ = gateway.interp2app(W_DictMultiObject.descr__contains__),
     __iter__ = gateway.interp2app(W_DictMultiObject.descr__iter__),
 
     items = gateway.interp2app(W_DictMultiObject.descr_items),
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -181,6 +181,11 @@
         assert d.has_key(1)
         assert not d.has_key(33)
 
+    def test_contains(self):
+        d = {1: 2, 3: 4}
+        assert 1 in d
+        assert 33 not in d
+
     def test_items(self):
         d = {1: 2, 3: 4}
         its = d.items()


More information about the pypy-commit mailing list