Author: Vincent Legoll <[email protected]>
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):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit