[pypy-commit] pypy default: Fix test_descr, by reverting this pypy change.

arigo noreply at buildbot.pypy.org
Wed Jun 29 12:00:58 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r45177:e3b7e2cb8bdb
Date: 2011-06-29 12:07 +0200
http://bitbucket.org/pypy/pypy/changeset/e3b7e2cb8bdb/

Log:	Fix test_descr, by reverting this pypy change.

	Improve test_typedef and make it work with py.test -A.

diff --git a/lib-python/modified-2.7/test/test_descr.py b/lib-python/modified-2.7/test/test_descr.py
--- a/lib-python/modified-2.7/test/test_descr.py
+++ b/lib-python/modified-2.7/test/test_descr.py
@@ -4399,14 +4399,8 @@
         self.assertTrue(l.__add__ != [5].__add__)
         self.assertTrue(l.__add__ != l.__mul__)
         self.assertTrue(l.__add__.__name__ == '__add__')
-        if hasattr(l.__add__, '__self__'):
-            # CPython
-            self.assertTrue(l.__add__.__self__ is l)
-            self.assertTrue(l.__add__.__objclass__ is list)
-        else:
-            # Python implementations where [].__add__ is a normal bound method
-            self.assertTrue(l.__add__.im_self is l)
-            self.assertTrue(l.__add__.im_class is list)
+        self.assertTrue(l.__add__.__self__ is l)
+        self.assertTrue(l.__add__.__objclass__ is list)
         self.assertEqual(l.__add__.__doc__, list.__add__.__doc__)
         try:
             hash(l.__add__)
diff --git a/pypy/interpreter/test/test_typedef.py b/pypy/interpreter/test/test_typedef.py
--- a/pypy/interpreter/test/test_typedef.py
+++ b/pypy/interpreter/test/test_typedef.py
@@ -205,6 +205,7 @@
         raises(OSError, os.lseek, fd, 7, 0)
 
     def test_method_attrs(self):
+        import sys
         class A(object):
             def m(self):
                 "aaa"
@@ -213,8 +214,15 @@
         bm = A().m
         assert bm.__func__ is bm.im_func
         assert bm.__self__ is bm.im_self
-        assert bm.__objclass__ is bm.im_class is A
+        assert bm.im_class is A
+        if '__pypy__' in sys.builtin_module_names:
+            assert bm.__objclass__ is A
         assert bm.__doc__ == "aaa"
         assert bm.x == 3
         raises(AttributeError, setattr, bm, 'x', 15)
-        assert [].append.__objclass__ is list
\ No newline at end of file
+        l = []
+        assert l.append.__self__ is l
+        if '__pypy__' in sys.builtin_module_names:
+            assert l.append.__objclass__ is list
+        assert l.__add__.__self__ is l
+        assert l.__add__.__objclass__ is list


More information about the pypy-commit mailing list