Пример #1
0
def test_no_decorator():
    def foo():
        return 2

    t.task("foo")(foo)
    t.app.run(None, ["foo"])
    t.eq(t.app._dbg, [("foo", 2)])
Пример #2
0
def test_two_task_cycle():
    t.task("foo", ["bar"])(lambda: 2)
    t.task("bar", ["foo"])(lambda: "hi")
    
    for task in ["foo", "bar"]:
        t.app.clear()
        t.raises(t.DependencyCycleError, t.app.run, None, [task])
        t.eq(t.app._dbg, [])
Пример #3
0
def test_adding_more_actions():
    def foo():
        return 2
    def bar():
        return "hi"
    t.task("foo")(foo)
    t.task("foo")(bar)
    t.app.run(None, ["foo"])
    t.eq(t.app._dbg, [("foo", 2), ("foo", "hi")])
    t.raises(t.TaskNotFoundError, t.app.run, None, ["bar"])
Пример #4
0
def test_adding_more_actions():
    def foo():
        return 2

    def bar():
        return "hi"

    t.task("foo")(foo)
    t.task("foo")(bar)
    t.app.run(None, ["foo"])
    t.eq(t.app._dbg, [("foo", 2), ("foo", "hi")])
    t.raises(t.TaskNotFoundError, t.app.run, None, ["bar"])
Пример #5
0
def test_lambda_action():
    print t.task(lambda: 4.5)
    print t.app.mgr.tasks
    t.app.run(None, ["<lambda>.1"])
    t.eq(t.app._dbg, [("<lambda>.1", 4.5)])
Пример #6
0
def test_no_decorator():
    def foo():
        return 2
    t.task("foo")(foo)
    t.app.run(None, ["foo"])
    t.eq(t.app._dbg, [("foo", 2)])
Пример #7
0
def test_lambda_action():
    print t.task(lambda: 4.5)
    print t.app.mgr.tasks
    t.app.run(None, ["<lambda>.1"])
    t.eq(t.app._dbg, [("<lambda>.1", 4.5)])
Пример #8
0
def test_ring_cycle():
    t.task("foo")(lambda: 2)
    t.task("bar")(lambda: "hi")
    t.task("frog")(lambda: "bird")
    
    t.task("foo", ["frog"])
    t.task("bar", ["foo"])
    t.task("frog", ["bar"])

    for task in ["foo", "bar", "frog"]:
        t.app.clear()
        t.raises(t.DependencyCycleError, t.app.run, None, [task])
        t.eq(t.app._dbg, [])