Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r45309:f09af652dc8e
Date: 2011-07-03 09:47 +0200
http://bitbucket.org/pypy/pypy/changeset/f09af652dc8e/

Log:    Fix the tests.

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
@@ -4400,7 +4400,10 @@
         self.assertTrue(l.__add__ != l.__mul__)
         self.assertTrue(l.__add__.__name__ == '__add__')
         self.assertTrue(l.__add__.__self__ is l)
-        self.assertTrue(l.__add__.__objclass__ is list)
+        if hasattr(l.__add__, '__objclass__'):   # CPython
+            self.assertTrue(l.__add__.__objclass__ is list)
+        else:                                    # PyPy
+            self.assertTrue(l.__add__.im_class 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
@@ -210,10 +210,20 @@
             def m(self):
                 "aaa"
             m.x = 3
+        class B(A):
+            pass
 
-        bm = A().m
+        bm = B().m
         assert bm.__func__ is bm.im_func
         assert bm.__self__ is bm.im_self
+        assert bm.im_class is B
         assert bm.__doc__ == "aaa"
         assert bm.x == 3
         raises(AttributeError, setattr, bm, 'x', 15)
+        l = []
+        assert l.append.__self__ is l
+        assert l.__add__.__self__ is l
+        # note: 'l.__add__.__objclass__' is not defined in pypy
+        # because it's a regular method, and .__objclass__
+        # differs from .im_class in case the method is
+        # defined in some parent class of l's actual class
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to