Exemple #1
0
def test_last_task_ended_returns_true_when_last_assigned_task_ended():
    processor = Processor()
    processor.add_time_unit()
    t = Task('T1', 2, 2)
    processor.set_task(t)
    processor.add_time_unit()
    assert processor.last_task_ended()
Exemple #2
0
def test_add_time_unit_inserts_previous_task_when_last_task_not_ended():
    processor = Processor()
    processor.add_time_unit()
    t = Task('T1', 2, 2)
    processor.set_task(t)
    processor.add_time_unit()
    assert len(processor.time_units) == 2
    assert processor.time_units[1] == t
Exemple #3
0
def test_add_time_unit_inserts_none_when_last_task_ended():
    processor = Processor()
    processor.add_time_unit()
    t = Task('T1', 2, 1)
    processor.set_task(t)
    processor.add_time_unit()
    assert len(processor.time_units) == 2
    assert processor.time_units[1] is None
Exemple #4
0
def test_get_current_task_returns_last_time_units_element():
    processor = Processor()
    processor.add_time_unit()
    t = Task('T1', 1, 1)
    processor.set_task(t)
    assert processor.get_current_task() == t
Exemple #5
0
def test_set_task_set_last_time_unit_with_task_when_task_provided():
    processor = Processor()
    processor.add_time_unit()
    t = Task('T1', 1, 1)
    processor.set_task(t)
    assert processor.time_units[0] == t
Exemple #6
0
def test_is_fee_returns_false_when_current_task_is_not_none():
    processor = Processor()
    processor.add_time_unit()
    processor.set_task(Task('T1', 2, 2))
    assert not processor.is_free()