[pypy-commit] pypy fix-2211: Add a failing test for non cryptic extended slicing exception message
Vincent Legoll
pypy.commits at gmail.com
Sat Dec 19 07:59:18 EST 2015
Author: Vincent Legoll <vincent.legoll at idgrilles.fr>
Branch: fix-2211
Changeset: r81391:1d79773109e7
Date: 2015-12-16 19:09 +0100
http://bitbucket.org/pypy/pypy/changeset/1d79773109e7/
Log: Add a failing test for non cryptic extended slicing exception
message
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
@@ -3516,6 +3516,19 @@
s = a.build_types(f, [unicode])
assert isinstance(s, annmodel.SomeUnicodeString)
+ def test_extended_slice(self):
+ def f(start, end, step):
+ return [1, 2, 3][start:end:step]
+
+ a = self.RPythonAnnotator()
+ py.test.raises(AnnotatorError, "a.build_types(f, [int, int, int])")
+ a.build_types(f, [annmodel.SomeInteger(nonneg=True),
+ annmodel.SomeInteger(nonneg=True),
+ annmodel.SomeInteger(nonneg=True)])
+ def f(x):
+ return x[:-1]
+
+ a.build_types(f, [str])
def test_negative_slice(self):
def f(s, e):
More information about the pypy-commit
mailing list