Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r67256:d91e484f733e
Date: 2013-10-09 19:17 +0200
http://bitbucket.org/pypy/pypy/changeset/d91e484f733e/
Log: some tests for error messages
diff --git a/rpython/annotator/test/test_annrpython.py
b/rpython/annotator/test/test_annrpython.py
--- a/rpython/annotator/test/test_annrpython.py
+++ b/rpython/annotator/test/test_annrpython.py
@@ -3442,6 +3442,29 @@
a.build_types(f, [str])
+ def test_negative_number_find(self):
+ def f(s, e):
+ return "xyz".find("x", s, e)
+
+ a = self.RPythonAnnotator()
+ py.test.raises(annmodel.AnnotatorError, "a.build_types(f, [int, int])")
+ a.build_types(f, [annmodel.SomeInteger(nonneg=True),
+ annmodel.SomeInteger(nonneg=True)])
+ def f(s, e):
+ return "xyz".rfind("x", s, e)
+
+ py.test.raises(annmodel.AnnotatorError, "a.build_types(f, [int, int])")
+ a.build_types(f, [annmodel.SomeInteger(nonneg=True),
+ annmodel.SomeInteger(nonneg=True)])
+
+ def f(s, e):
+ return "xyz".count("x", s, e)
+
+ py.test.raises(annmodel.AnnotatorError, "a.build_types(f, [int, int])")
+ a.build_types(f, [annmodel.SomeInteger(nonneg=True),
+ annmodel.SomeInteger(nonneg=True)])
+
+
def test_setslice(self):
def f():
lst = [2, 5, 7]
@@ -4080,7 +4103,7 @@
with py.test.raises(annmodel.UnionError) as exc:
a.build_types(f, [int])
- assert ("RPython cannot unify instances with no common base class"
+ assert ("RPython cannot unify instances with no common base class"
in exc.value.msg)
def test_unionerror_iters(self):
@@ -4096,7 +4119,7 @@
with py.test.raises(annmodel.UnionError) as exc:
a.build_types(f, [int])
- assert ("RPython cannot unify incompatible iterator variants" in
+ assert ("RPython cannot unify incompatible iterator variants" in
exc.value.msg)
def test_variable_getattr(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit