Author: Edd Barrett <[email protected]>
Branch: improve-errors-again2
Changeset: r66665:372483cc80bb
Date: 2013-08-30 14:45 +0100
http://bitbucket.org/pypy/pypy/changeset/372483cc80bb/
Log: (Edd, Ronan) Fix some more failing tests.
Listdef exceptions should subclass AnnotatorError. Do not use repr()
on instances of AnnotatorErrror.
diff --git a/rpython/annotator/listdef.py b/rpython/annotator/listdef.py
--- a/rpython/annotator/listdef.py
+++ b/rpython/annotator/listdef.py
@@ -1,12 +1,12 @@
from rpython.annotator.model import s_ImpossibleValue
from rpython.annotator.model import SomeList, SomeString
-from rpython.annotator.model import unionof, TLS, UnionError
+from rpython.annotator.model import unionof, TLS, UnionError, AnnotatorError
-class TooLateForChange(Exception):
+class TooLateForChange(AnnotatorError):
pass
-class ListChangeUnallowed(Exception):
+class ListChangeUnallowed(AnnotatorError):
pass
class ListItem(object):
diff --git a/rpython/rlib/test/test_signature.py
b/rpython/rlib/test/test_signature.py
--- a/rpython/rlib/test/test_signature.py
+++ b/rpython/rlib/test/test_signature.py
@@ -246,8 +246,8 @@
pass
exc = py.test.raises(Exception, annotate_at, C.incomplete_sig_meth).value
- assert 'incomplete_sig_meth' in repr(exc.args)
- assert 'finishsigs' in repr(exc.args)
+ assert 'incomplete_sig_meth' in str(exc)
+ assert 'finishsigs' in str(exc)
def test_any_as_argument():
@signature(types.any(), types.int(), returns=types.float())
@@ -269,7 +269,7 @@
def cannot_add_string(x):
return f(x, 2)
exc = py.test.raises(Exception, annotate_at, cannot_add_string).value
- assert 'Blocked block' in repr(exc.args)
+ assert 'Blocked block' in str(exc)
def test_return_any():
@signature(types.int(), returns=types.any())
@@ -282,8 +282,8 @@
def cannot_add_string(x):
return f(3) + x
exc = py.test.raises(Exception, annotate_at, cannot_add_string).value
- assert 'Blocked block' in repr(exc.args)
- assert 'cannot_add_string' in repr(exc.args)
+ assert 'Blocked block' in str(exc)
+ assert 'cannot_add_string' in str(exc)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit