Exemplo n.º 1
0
def test_tick():
    period = Period()
    clock = Clock(period)
    clock.tick()
    assert_true(clock.clock > 0)
    period = Period()
    clock = Clock(period)
    clock.tick(30)
    assert_equal(30, clock.clock)
Exemplo n.º 2
0
def test_add():
    event = Event()
    period = Period()
    clock = Clock(period)
    possession = Possession()
    zone = Zone()
    play = Start(None, None, zone, possession)
    event.add(period, clock, play, zone)
    assert_equal(1, event.event)
    assert_true(len(event.events) == 1)
    assert_equal(period.period, event.events[0]['period'])
    assert_equal('00:00', event.events[0]['elapsed'])
    assert_equal('20:00', event.events[0]['remaining'])
    assert_equal(play.name, event.events[0]['play'])
    assert_equal(zone.name, event.events[0]['zone'])
Exemplo n.º 3
0
def test_since_last_tick():
    period = Period()
    clock = Clock(period)
    clock.tick(30)
    assert_equal(30, clock.since_last_tick)
Exemplo n.º 4
0
def test_remaining():
    period = Period()
    clock = Clock(period)
    assert_equal('20:00', clock.remaining)
    clock.tick(30)
    assert_equal('19:30', clock.remaining)
Exemplo n.º 5
0
def test_elapsed():
    period = Period()
    clock = Clock(period)
    assert_equal('00:00', clock.elapsed)
    clock.tick(30)
    assert_equal('00:30', clock.elapsed)
Exemplo n.º 6
0
def test_running():
    period = Period()
    clock = Clock(period)
    assert_true(clock.running)
Exemplo n.º 7
0
def test_end():
    period = Period()
    clock = Clock(period)
    clock.end()
    assert_true(clock.clock == clock.total_time)
Exemplo n.º 8
0
def test_init():
    period = Period()
    clock = Clock(period)
    assert_equal(0, clock.clock)
    assert_equal(0, clock.last_tick)
    assert_equal(1200, clock.total_time)