Attempt to refactor a bit of context, new count transform that counts the calls, new bonobo.structs package with basic data structures, removal of blessings.

This commit is contained in:
Romain Dorgueil
2017-04-24 23:44:29 +02:00
parent cff32c1612
commit ef2c881075
37 changed files with 405 additions and 145 deletions

View File

@ -0,0 +1,42 @@
import pytest
from bonobo import Graph, BEGIN
identity = lambda x: x
def test_graph_outputs_of():
g = Graph()
# default graph only node
assert len(g.outputs_of(BEGIN)) == 0
# unexisting node
with pytest.raises(KeyError):
g.outputs_of(0)
# create node
assert len(g.outputs_of(0, create=True)) == 0
assert len(g.outputs_of(0)) == 0
def test_graph_add_component():
g = Graph()
assert len(g.nodes) == 0
g.add_node(identity)
assert len(g.nodes) == 1
g.add_node(identity)
assert len(g.nodes) == 2
def test_graph_add_chain():
g = Graph()
assert len(g.nodes) == 0
g.add_chain(identity, identity, identity)
assert len(g.nodes) == 3
assert len(g.outputs_of(BEGIN)) == 1