Commit 7f2b1875 authored by Stefan Behnel's avatar Stefan Behnel

extended test case

parent 9cc37c4c
...@@ -181,6 +181,28 @@ def multimanager(): ...@@ -181,6 +181,28 @@ def multimanager():
print('%s %s %s %s %s' % (a, b, c, d, e)) print('%s %s %s %s %s' % (a, b, c, d, e))
print(nested) print(nested)
class GetManager(object):
def get(self, *args):
return ContextManager(*args)
def manager_from_expression():
"""
>>> manager_from_expression()
enter
1
exit <type 'NoneType'> <type 'NoneType'> <type 'NoneType'>
enter
2
exit <type 'NoneType'> <type 'NoneType'> <type 'NoneType'>
"""
with GetManager().get(1) as x:
print x
g = GetManager()
with g.get(2) as x:
print x
# Tests borrowed from pyregr test_with.py, # Tests borrowed from pyregr test_with.py,
# modified to follow the constraints of Cython. # modified to follow the constraints of Cython.
import unittest import unittest
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment