Commits

Jeremy Thurgood committed 7563dcd Draft

Some tests for enumerating rstrs.

Comments (0)

Files changed (1)

rpython/annotator/test/test_annrpython.py

         s = a.build_types(f, [])
         assert isinstance(s, annmodel.SomeChar)
 
+    def test_enumerate_str(self):
+        def f():
+            for i, x in enumerate('abcd'):
+                if i == 2:
+                    return x
+            return '?'
+        a = self.RPythonAnnotator()
+        s = a.build_types(f, [])
+        assert isinstance(s, annmodel.SomeChar)
+
+    def test_enumerate_unicode(self):
+        def f():
+            for i, x in enumerate(u'abcd'):
+                if i == 2:
+                    return x
+            return '?'
+        a = self.RPythonAnnotator()
+        s = a.build_types(f, [])
+        assert isinstance(s, annmodel.SomeUnicodeCodePoint)
+
     def test_context_manager(self):
         class C:
             def __init__(self):