Author: Carl Friedrich Bolz <[email protected]>
Branch: value-profiling
Changeset: r81903:7e6dd66f2318
Date: 2016-01-22 09:17 +0100
http://bitbucket.org/pypy/pypy/changeset/7e6dd66f2318/

Log:    test that found the problem of the previous commit

diff --git a/pypy/objspace/std/test/test_mapdict.py 
b/pypy/objspace/std/test/test_mapdict.py
--- a/pypy/objspace/std/test/test_mapdict.py
+++ b/pypy/objspace/std/test/test_mapdict.py
@@ -931,6 +931,21 @@
         d = x.__dict__
         assert list(__pypy__.reversed_dict(d)) == d.keys()[::-1]
 
+    def test_bug_two_attributes(self):
+        class A(object):
+            def __setitem__(self, key, value):
+                self.setkey = key
+                self.setvalue = value
+        a1 = A()
+        a2 = A()
+        a1[a2] = 42
+        assert a1.setkey is a2
+        assert a1.setvalue == 42
+        #
+        a1[42] = a2
+        assert a1.setkey == 42
+        assert a1.setvalue is a2
+
 
 class AppTestWithMapDictAndCounters(object):
     spaceconfig = {"objspace.std.withmapdict": True,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to