From: Vitja Makarov Date: Sun, 9 Jan 2011 11:07:01 +0000 (+0300) Subject: add test case for copied yield X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=aa4e15d301ed655d0d201e0532c70c5dd4431050;p=cython.git add test case for copied yield --- diff --git a/tests/run/generators.pyx b/tests/run/generators.pyx index 42e61352..ca2bd32b 100644 --- a/tests/run/generators.pyx +++ b/tests/run/generators.pyx @@ -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