Ejemplo n.º 1
0
def test_items():
    clear()
    add("Sandwich")
    expected_result = ("Sandwich", PENDING)
    actual_result = items()
    compare(1, len(actual_result))
    compare(expected_result, actual_result[0])
Ejemplo n.º 2
0
def test_index_by_text():
    clear()
    todo1_text = "Cheese Sandwich"
    todo2_text = "Meat Sandwich"
    add(todo1_text)
    compare(0, _index_by_text(todo1_text))
    add(todo2_text)
    compare(1, _index_by_text(todo2_text))
Ejemplo n.º 3
0
def test_mark_completed_by_text():
    clear()
    todo1_text = "Cheese Sandwich"
    todo2_text = "Meat Sandwich"
    add(todo1_text)
    add(todo2_text)
    mark_completed_by_text(todo1_text)
    expected_result = ((todo1_text, COMPLETED), (todo2_text, PENDING))
    compare(expected_result, items())
Ejemplo n.º 4
0
def test_status_by_text():
    clear()
    todo1_text = "Cheese Sandwich"
    todo2_text = "Meat Sandwich"
    add(todo1_text)
    add(todo2_text)
    mark_completed_by_text(todo2_text)
    compare(PENDING, status_by_text(todo1_text))
    compare(COMPLETED, status_by_text(todo2_text))
Ejemplo n.º 5
0
def test_task_with_no_descr():
    clear()
    try:
        add("")
    except ValueError as e:
        expected_message = "Empty item can't be added"
        compare(expected_message, e.message)
    else:
        assert False, "Test failed: ValueError exception should be thrown"
Ejemplo n.º 6
0
def test_next_pending():
    clear()
    add("Sandwich")
    add("Learn some python")
    add("Sleep")
    assert_equal("Sandwich", next_pending())
    mark_completed_by_text("Learn some python")
    assert_equal("Sandwich", next_pending())
    mark_completed_by_text("Sandwich")
    assert_equal("Sleep", next_pending())
Ejemplo n.º 7
0
def test_same_task():
    clear()
    task_name = "Sandwich"
    add_return_index = add(task_name)
    compare(0, add_return_index)
    add_return_index = add(task_name)
    compare(0, add_return_index)
    actual_result = items()
    expected_result = (task_name, PENDING)
    compare(1, len(actual_result))
    compare(expected_result, actual_result[0])
Ejemplo n.º 8
0
def test_add_return_value():
    clear()
    add_return_index = add("Sandwich")
    compare(0, add_return_index)
Ejemplo n.º 9
0
def test_clear():
    clear()
    compare((), items(), "Test Failed: items object is not empty")