add test case for copied yield
authorVitja Makarov <vitja.makarov@gmail.com>
Sun, 9 Jan 2011 11:07:01 +0000 (14:07 +0300)
committerVitja Makarov <vitja.makarov@gmail.com>
Sun, 9 Jan 2011 11:07:01 +0000 (14:07 +0300)
tests/run/generators.pyx

index 42e61352743de6904e16d01c39a988c8f8524987..ca2bd32b8d25709cd433d251db0981a58996b6af 100644 (file)
@@ -259,3 +259,16 @@ def test_return(a):
     yield 1
     a['i_was_here'] = True
     return
+
+def test_copied_yield(foo):
+    """
+    >>> class Manager(object):
+    ...    def __enter__(self):
+    ...        return self
+    ...    def __exit__(self, type, value, tb):
+    ...        pass
+    >>> list(test_copied_yield(Manager()))
+    [1]
+    """
+    with foo:
+        yield 1