예제 #1
0
파일: task.py 프로젝트: sshyran/zing
def test_taskresultset_get_single():
    """Tests retrieving a single task resultset item by index."""
    due_on = now = aware_datetime(2017, 2, 28, 9, 0)
    due_date = DueDateFactory.build(due_on=due_on)
    task = TranslationTask(due_date=due_date, now=now, words_left=1)
    task_resultset = TaskResultSet([task])
    assert task_resultset[0] == task.data
예제 #2
0
파일: task.py 프로젝트: ratanasoth/zing
def test_taskresultset_importance_order(test_name, snapshot_stack, sort_type,
                                        fake_task_args):
    """Tests ordering of tasks according to their importance."""
    tasks = [LightTask(*task_args) for task_args in fake_task_args]
    with snapshot_stack.push([as_dir(test_name), sort_type]) as snapshot:
        task_resultset = TaskResultSet(tasks).order_by_importance()
        snapshot.assert_matches([task for task in task_resultset])
예제 #3
0
파일: task.py 프로젝트: sshyran/zing
def test_taskresultset_get_raises(index):
    """Tests retrieving from a task resultset by using an invalid index/slice."""
    due_on = now = aware_datetime(2017, 2, 28, 9, 0)
    due_date = DueDateFactory.build(due_on=due_on)
    task = TranslationTask(due_date=due_date, now=now, words_left=1)
    task_resultset = TaskResultSet([task])
    with pytest.raises(TypeError):
        task_resultset[index]