Skip to content

Commit 670d893

Browse files
committed
Adds simple test for #326.
1 parent 3419492 commit 670d893

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

bonobo/util/testing.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,14 @@ def get_pseudo_nodes(*names):
297297
298298
>>> a, b, c = get_pseudo_nodes(*"abc")
299299
300+
Alternate syntax:
301+
302+
>>> a, b, c = get_pseudo_nodes(3)
303+
300304
"""
305+
if len(names) == 1 and isinstance(names[0], int):
306+
yield from get_pseudo_nodes(*map(chr, range(ord("a"), ord("a") + names[0])))
307+
return
308+
301309
for name in names:
302310
yield getattr(sentinel, name)

tests/structs/test_graphs_new_syntax.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,21 @@ def test_cursor_merge_orphan_in_between():
140140
assert g.outputs_of(w) == g.indexes_of(b)
141141
assert g.outputs_of(x) == g.indexes_of(y)
142142
assert g.outputs_of(y) == g.indexes_of(b)
143+
144+
145+
def test_using_same_cursor_many_times_for_fork():
146+
a, b, c, d, e = get_pseudo_nodes(5)
147+
g = Graph()
148+
149+
c0 = g >> a >> b
150+
151+
c0 >> c
152+
c0 >> d
153+
c0 >> e
154+
155+
assert g.outputs_of(BEGIN) == g.indexes_of(a)
156+
assert g.outputs_of(a) == g.indexes_of(b)
157+
assert g.outputs_of(b) == g.indexes_of(c, d, e)
158+
assert g.outputs_of(c) == set()
159+
assert g.outputs_of(d) == set()
160+
assert g.outputs_of(e) == set()

0 commit comments

Comments
 (0)