Inheritance of bags and better jupyter output for pretty printer.

This commit is contained in:
Romain Dorgueil
2017-11-28 21:58:01 +01:00
parent c7ff06a742
commit d8c0dfe11a
10 changed files with 180 additions and 51 deletions

View File

@ -0,0 +1,27 @@
from bonobo.constants import INHERIT
from bonobo.util.testing import BufferingNodeExecutionContext
messages = [
('Hello', ),
('Goodbye', ),
]
def append(*args):
return INHERIT, '!'
def test_inherit():
with BufferingNodeExecutionContext(append) as context:
context.write_sync(*messages)
assert context.get_buffer() == list(map(lambda x: x + ('!', ), messages))
def test_inherit_bag_tuple():
with BufferingNodeExecutionContext(append) as context:
context.set_input_fields(['message'])
context.write_sync(*messages)
assert context.get_output_fields() == ('message', '0')
assert context.get_buffer() == list(map(lambda x: x + ('!', ), messages))