implements bags, so we can pass arbitrary args/kwargs to functions.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from bonobo.core.graphs import Graph
|
||||
from bonobo.util.tokens import BEGIN
|
||||
from bonobo.util.tokens import Begin
|
||||
|
||||
identity = lambda x: x
|
||||
|
||||
@ -10,7 +10,7 @@ def test_graph_outputs_of():
|
||||
g = Graph()
|
||||
|
||||
# default graph only node
|
||||
assert len(g.outputs_of(BEGIN)) == 0
|
||||
assert len(g.outputs_of(Begin)) == 0
|
||||
|
||||
# unexisting node
|
||||
with pytest.raises(KeyError):
|
||||
@ -40,4 +40,4 @@ def test_graph_add_chain():
|
||||
|
||||
g.add_chain(identity, identity, identity)
|
||||
assert len(g.components) == 3
|
||||
assert len(g.outputs_of(BEGIN)) == 1
|
||||
assert len(g.outputs_of(Begin)) == 1
|
||||
|
||||
@ -20,7 +20,7 @@ import pytest
|
||||
|
||||
from bonobo.core.errors import InactiveWritableError, InactiveReadableError
|
||||
from bonobo.core.inputs import Input
|
||||
from bonobo.util.tokens import BEGIN, END
|
||||
from bonobo.util.tokens import Begin, End
|
||||
|
||||
|
||||
def test_input_runlevels():
|
||||
@ -32,15 +32,15 @@ def test_input_runlevels():
|
||||
q.put('hello, unborn queue.')
|
||||
|
||||
# Begin
|
||||
q.put(BEGIN)
|
||||
q.put(Begin)
|
||||
assert q.alive and q._runlevel == 1
|
||||
q.put('foo')
|
||||
|
||||
# Second Begin
|
||||
q.put(BEGIN)
|
||||
q.put(Begin)
|
||||
assert q.alive and q._runlevel == 2
|
||||
q.put('bar')
|
||||
q.put(END)
|
||||
q.put(End)
|
||||
|
||||
# FIFO
|
||||
assert q.get() == 'foo'
|
||||
@ -56,7 +56,7 @@ def test_input_runlevels():
|
||||
q.put('baz')
|
||||
|
||||
# Now kill the queue...
|
||||
q.put(END)
|
||||
q.put(End)
|
||||
with pytest.raises(InactiveWritableError):
|
||||
q.put('foo')
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ from bonobo import inject, service
|
||||
class MyFoo():
|
||||
pass
|
||||
|
||||
|
||||
def test_service_is_singleton():
|
||||
@service
|
||||
def foo():
|
||||
@ -21,4 +22,3 @@ def test_service_is_singleton():
|
||||
|
||||
assert type(foo()) == type(foo2())
|
||||
assert foo2() is not foo()
|
||||
|
||||
|
||||
@ -5,8 +5,7 @@ class MyThingWithStats(WithStatistics):
|
||||
def get_stats(self, *args, **kwargs):
|
||||
return (
|
||||
('foo', 42),
|
||||
('bar', 69),
|
||||
)
|
||||
('bar', 69), )
|
||||
|
||||
|
||||
def test_with_statistics():
|
||||
|
||||
Reference in New Issue
Block a user