Example #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
Example #2
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
Example #3
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()
Example #4
0
def test_command_added():
    t = Ticker(1)
    #hackish
    called = []
    t.add_command(lambda: called.append(True))
    t.tick()
    assert called
Example #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()
Example #6
0
def test_command_added():
    t = Ticker(1)
    #hackish
    called = []
    t.add_command(lambda: called.append(True))
    t.tick()
    assert called
Example #7
0
def test_frequency_persists():
    freq = 1
    t = Ticker(freq)
    t = pickle.loads(pickle.dumps(t))
    assert t.freq == freq
Example #8
0
def test_ticker_freq_setting():
    interval = 0.5
    t = Ticker(interval)
    assert t.freq == interval