[pypy-svn] r57084 - in pypy/branch/isinstance-refactor/pypy/module/__builtin__: . test
arigo at codespeak.net
arigo at codespeak.net
Thu Aug 7 21:07:45 CEST 2008
Author: arigo
Date: Thu Aug 7 21:07:42 2008
New Revision: 57084
Modified:
pypy/branch/isinstance-refactor/pypy/module/__builtin__/interp_classobj.py
pypy/branch/isinstance-refactor/pypy/module/__builtin__/test/test_classobj.py
Log:
- a passing test
- a failing test
- skip a test when running on top of CPython
- fix the failing test
Modified: pypy/branch/isinstance-refactor/pypy/module/__builtin__/interp_classobj.py
==============================================================================
--- pypy/branch/isinstance-refactor/pypy/module/__builtin__/interp_classobj.py (original)
+++ pypy/branch/isinstance-refactor/pypy/module/__builtin__/interp_classobj.py Thu Aug 7 21:07:42 2008
@@ -235,6 +235,7 @@
except OperationError, e:
if e.match(space, space.w_AttributeError):
return space.w_NotImplemented
+ raise
else:
if w_meth is None:
return space.w_NotImplemented
Modified: pypy/branch/isinstance-refactor/pypy/module/__builtin__/test/test_classobj.py
==============================================================================
--- pypy/branch/isinstance-refactor/pypy/module/__builtin__/test/test_classobj.py (original)
+++ pypy/branch/isinstance-refactor/pypy/module/__builtin__/test/test_classobj.py Thu Aug 7 21:07:42 2008
@@ -444,6 +444,21 @@
raises(TypeError, "a + 1.1")
assert l == [1, 1.1]
+ def test_binaryop_raises(self):
+ class A:
+ def __add__(self, other):
+ raise this_exception
+ def __iadd__(self, other):
+ raise this_exception
+
+ a = A()
+ this_exception = ValueError
+ raises(ValueError, "a + 1")
+ raises(ValueError, "a += 1")
+ this_exception = AttributeError
+ raises(AttributeError, "a + 1")
+ raises(AttributeError, "a += 1")
+
def test_iadd(self):
class A:
def __init__(self):
@@ -647,13 +662,14 @@
def test_catch_attributeerror_of_descriptor(self):
def booh(self):
- raise AttributeError, "booh"
+ raise this_exception, "booh"
class E:
__eq__ = property(booh)
__iadd__ = property(booh)
e = E()
+ this_exception = AttributeError
raises(TypeError, "e += 1")
# does not crash
E() == E()
@@ -661,6 +677,9 @@
__init__ = property(booh)
raises(AttributeError, I)
+ this_exception = ValueError
+ raises(ValueError, "e += 1")
+
def test_multiple_inheritance_more(self):
l = []
class A: # classic class
@@ -715,6 +734,10 @@
assert Y() != X()
def test_assignment_to_del(self):
+ import sys
+ if not hasattr(sys, 'pypy_objspaceclass'):
+ skip("assignment to __del__ doesn't give a warning in CPython")
+
import warnings
warnings.simplefilter('error', RuntimeWarning)
More information about the Pypy-commit
mailing list