コード例 #1
0
def test_parse_add():
    command = "+ Fourth task"
    task_manager = TaskManager()

    action = task_manager.parse(command)

    assert action.name == "add"
    assert action.description == "Fourth task"
コード例 #2
0
def test_parse_delete():
    # Adding the task.
    command = "+ first task"
    task_manager = TaskManager()
    action = task_manager.parse(command)

    task_manager.parse_logic(action)
    task_added = task_manager.tasks[0]

    # Remove the task.
    command = "- first task"
    action = task_manager.parse(command)
    task_manager.parse_logic(action)

    # Check if task has been deleted.
    for _task in task_manager.tasks:
        if _task.id == task_added.id:
            AssertionError