mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-11 06:43:54 +00:00
Add a test for nested decorated generators
This commit is contained in:
parent
66d4a9b4a1
commit
d902f7567f
@ -315,6 +315,35 @@ class EliotFriendlyGeneratorFunctionTests(TestCase):
|
||||
],
|
||||
)
|
||||
|
||||
@capture_logging(None)
|
||||
def test_nested_generators(self, logger):
|
||||
@eliot_friendly_generator_function
|
||||
def g(recurse):
|
||||
with start_action(action_type=u"a-recurse={}".format(recurse)):
|
||||
Message.log(message_type=u"m-recurse={}".format(recurse))
|
||||
if recurse:
|
||||
set(g(False))
|
||||
else:
|
||||
yield
|
||||
|
||||
with start_action(action_type=u"the-action"):
|
||||
set(g(True))
|
||||
|
||||
assert_expected_action_tree(
|
||||
self,
|
||||
logger,
|
||||
u"the-action", [{
|
||||
u"a-recurse=True": [
|
||||
u"m-recurse=True", {
|
||||
u"a-recurse=False": [
|
||||
u"m-recurse=False",
|
||||
u"yielded",
|
||||
],
|
||||
},
|
||||
],
|
||||
}],
|
||||
)
|
||||
|
||||
|
||||
class InlineCallbacksTests(TestCase):
|
||||
# Get our custom assertion failure messages *and* the standard ones.
|
||||
|
Loading…
x
Reference in New Issue
Block a user