コード例 #1
0
ファイル: test_ticks.py プロジェクト: hosford42/grailmud
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
コード例 #2
0
ファイル: test_ticks.py プロジェクト: ViKingIX/grailmud
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
コード例 #3
0
ファイル: test_ticks.py プロジェクト: ViKingIX/grailmud
def test_clears_doing_list():
    def doing_list_checker():
        assert not ticker.doing

    ticker = Ticker(1)
    ticker.add_command(doing_list_checker)
    ticker.tick()
コード例 #4
0
ファイル: test_ticks.py プロジェクト: ViKingIX/grailmud
def test_command_added():
    t = Ticker(1)
    #hackish
    called = []
    t.add_command(lambda: called.append(True))
    t.tick()
    assert called
コード例 #5
0
ファイル: test_ticks.py プロジェクト: hosford42/grailmud
def test_clears_doing_list():
    def doing_list_checker():
        assert not ticker.doing

    ticker = Ticker(1)
    ticker.add_command(doing_list_checker)
    ticker.tick()
コード例 #6
0
ファイル: test_ticks.py プロジェクト: hosford42/grailmud
def test_command_added():
    t = Ticker(1)
    #hackish
    called = []
    t.add_command(lambda: called.append(True))
    t.tick()
    assert called
コード例 #7
0
ファイル: test_ticks.py プロジェクト: hosford42/grailmud
def test_frequency_persists():
    freq = 1
    t = Ticker(freq)
    t = pickle.loads(pickle.dumps(t))
    assert t.freq == freq
コード例 #8
0
ファイル: test_ticks.py プロジェクト: hosford42/grailmud
def test_ticker_freq_setting():
    interval = 0.5
    t = Ticker(interval)
    assert t.freq == interval