Jeremy Thurgood avatar Jeremy Thurgood committed 7563dcd

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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.