Exemple #1
0
def test_doing_persists():
    t = Ticker(1)
    t.add_command(foo_function_1)
    t.add_command(foo_function_2)
    olddoing = t.doing
    t = pickle.loads(pickle.dumps(t))
    assert t.doing == olddoing
Exemple #2
0
def test_clears_doing_list():
    def doing_list_checker():
        assert not ticker.doing

    ticker = Ticker(1)
    ticker.add_command(doing_list_checker)
    ticker.tick()
Exemple #3
0
def test_command_added():
    t = Ticker(1)
    #hackish
    called = []
    t.add_command(lambda: called.append(True))
    t.tick()
    assert called
Exemple #4
0
def test_doing_persists():
    t = Ticker(1)
    t.add_command(foo_function_1)
    t.add_command(foo_function_2)
    olddoing = t.doing
    t = pickle.loads(pickle.dumps(t))
    assert t.doing == olddoing
Exemple #5
0
def test_clears_doing_list():
    def doing_list_checker():
        assert not ticker.doing

    ticker = Ticker(1)
    ticker.add_command(doing_list_checker)
    ticker.tick()
Exemple #6
0
def test_command_added():
    t = Ticker(1)
    #hackish
    called = []
    t.add_command(lambda: called.append(True))
    t.tick()
    assert called