[core] Refactoring IOFormats so there is one and only obvious way to send it.
This is the commit where I admit that having more than one input/output format for readers and writers was complicating the code too much for a very small gain, and that it would be easier to only have one way to do it. So such way is now: - Returning (or yielding) a dict if you have key-value type collections. - Returning (or yielding) a tuple if you have a list-type collection. - Returning (or yielding) something else otherwise, which will continue to work like the old "arg0" format. IOFORMAT options has been removed in favour of a RemovedOption, which will complain if you're still trying to set it to anything else than the one value allowed.
This commit is contained in:
@ -51,31 +51,31 @@ def test_simple_execution_context():
|
||||
graph = Graph()
|
||||
graph.add_chain(*chain)
|
||||
|
||||
ctx = GraphExecutionContext(graph)
|
||||
assert len(ctx.nodes) == len(chain)
|
||||
assert not len(ctx.plugins)
|
||||
context = GraphExecutionContext(graph)
|
||||
assert len(context.nodes) == len(chain)
|
||||
assert not len(context.plugins)
|
||||
|
||||
for i, node in enumerate(chain):
|
||||
assert ctx[i].wrapped is node
|
||||
assert context[i].wrapped is node
|
||||
|
||||
assert not ctx.alive
|
||||
assert not ctx.started
|
||||
assert not ctx.stopped
|
||||
assert not context.alive
|
||||
assert not context.started
|
||||
assert not context.stopped
|
||||
|
||||
ctx.write(BEGIN, Bag(), END)
|
||||
context.write(BEGIN, Bag(), END)
|
||||
|
||||
assert not ctx.alive
|
||||
assert not ctx.started
|
||||
assert not ctx.stopped
|
||||
assert not context.alive
|
||||
assert not context.started
|
||||
assert not context.stopped
|
||||
|
||||
ctx.start()
|
||||
context.start()
|
||||
|
||||
assert ctx.alive
|
||||
assert ctx.started
|
||||
assert not ctx.stopped
|
||||
assert context.alive
|
||||
assert context.started
|
||||
assert not context.stopped
|
||||
|
||||
ctx.stop()
|
||||
context.stop()
|
||||
|
||||
assert not ctx.alive
|
||||
assert ctx.started
|
||||
assert ctx.stopped
|
||||
assert not context.alive
|
||||
assert context.started
|
||||
assert context.stopped
|
||||
|
||||
Reference in New Issue
Block a user