Author: Vincent Legoll <vincent.leg...@idgrilles.fr>
Branch: fix-2211
Changeset: r81394:b8db626fca5e
Date: 2015-12-16 21:09 +0100
http://bitbucket.org/pypy/pypy/changeset/b8db626fca5e/

Log:    Test more cases recreate the annotator between each test

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
@@ -3517,18 +3517,31 @@
         assert isinstance(s, annmodel.SomeUnicodeString)
 
     def test_extended_slice(self):
+        a = self.RPythonAnnotator()
         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)])
+        with py.test.raises(AnnotatorError):
+            a.build_types(f, [int, int, int])
+        a = self.RPythonAnnotator()
+        with py.test.raises(AnnotatorError):
+            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])
+            return x[::-1]
+        a = self.RPythonAnnotator()
+        with py.test.raises(AnnotatorError):
+            a.build_types(f, [str])
+        def f(x):
+            return x[::2]
+        a = self.RPythonAnnotator()
+        with py.test.raises(AnnotatorError):
+            a.build_types(f, [str])
+        def f(x):
+            return x[1:2:1]
+        a = self.RPythonAnnotator()
+        with py.test.raises(AnnotatorError):
+            a.build_types(f, [str])
 
     def test_negative_slice(self):
         def f(s, e):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to