[pypy-svn] r49672 - pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/test

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Dec 12 13:12:38 CET 2007


Author: cfbolz
Date: Wed Dec 12 13:12:36 2007
New Revision: 49672

Modified:
   pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/test/test_classobj.py
Log:
a test that you can override special attributes on the instance


Modified: pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/test/test_classobj.py
==============================================================================
--- pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/test/test_classobj.py	(original)
+++ pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/test/test_classobj.py	Wed Dec 12 13:12:36 2007
@@ -359,3 +359,15 @@
         del a.A
         assert a.a == 1
 
+    def test_instance_override(self):
+        class A:
+            __metaclass__ = nclassobj
+            def __str__(self):
+                return "foo"
+        def __str__():
+            return "bar"
+        a = A()
+        assert str(a) == "foo"
+        a.__str__ = __str__
+        assert str(a) == "bar"
+



More information about the Pypy-commit mailing list