コード例 #1
0
def test_wr_creates_project_if_doesnt_exist(tasks, wr):
    tasks.add_task(t := Task("research graduate programs"))
    wr.assign_task_to_project(t, 'earn_degree')
    assert list(tasks) == [
        Task("research graduate programs prj:earn_degree"),
        Task("prj:earn_degree @@@project"),
    ]
コード例 #2
0
def test_can_assign_to_existing_project(tasks, wr):
    tasks.add_task(Task("prj:earn_degree @@@project"))
    tasks.add_task(t := Task("research graduate programs"))
    wr.assign_task_to_project(t, 'earn_degree')
    assert list(tasks) == [
        Task("prj:earn_degree @@@project"),
        Task("research graduate programs prj:earn_degree"),
    ]
コード例 #3
0
def test_can_uncomplete():
    l = Task("x c")
    l.uncomplete()
    assert l.persist == "c"
コード例 #4
0
def test_empty_priority_is_none():
    t = Task("@home b c h:1 +mytag @whoa")
    assert t.priority is None
コード例 #5
0
def test_can_get_extensions():
    t = Task("@home b c h:1 +mytag @whoa")
    extension = t.extensions['h']
    assert "h:1" == extension.persist
コード例 #6
0
def test_can_get_contexts():
    t = Task("@home b c +mytag @whoa")
    contexts = {c.persist for c in t.contexts}
    assert {"@home", "@whoa"} == contexts
コード例 #7
0
def test_can_get_creation_date_when_also_completed():
    l = Task("x 2015-02-05 2015-01-27 c")
    assert l.creation_date == date(2015, 1, 27)
コード例 #8
0
def test_knows_when_completion_date_is_none():
    l = Task("x 2015-01-27 c")
    assert l.completion_date == None
コード例 #9
0
def test_generic_words_must_stay_as_lumps_for_equality():
    t1 = Task("a b")
    t2 = Task("b a")
    assert_tasks_not_equal(t1, t2)
コード例 #10
0
def test_can_evaluate_equality():
    t1 = Task("c +mytag")
    t2 = Task("+mytag c")
    t3 = Task("+mytag d")
    assert_tasks_equal(t1, t2)
    assert_tasks_not_equal(t1, t3)
コード例 #11
0
def test_turn_task_into_project(wr):
    t = Task("earn degree")
    wr.convert_task_to_project(t)
    assert_tasks_equal(t, Task("prj:earn_degree @@@project"))
コード例 #12
0
def test_can_read_tasks_from_file_and_ignore_blankslines(tasks):
    sio = StringIO("hello\n\nworld\n")
    tasks.add_tasks_from_file(sio)
    assert list(tasks) == [Task("hello"), Task("world")]
コード例 #13
0
def test_can_read_tasks_from_file(tasks):
    sio = StringIO("hello\nworld\n")
    tasks.add_tasks_from_file(sio)
    assert list(tasks) == [Task("hello"), Task("world")]
コード例 #14
0
def test_can_add_tasks(tasks):
    tasks.add_tasks_from_list(["hello", "world"])
    assert list(tasks) == [Task("hello"), Task("world")]
コード例 #15
0
def test_can_get_creation_date():
    l = Task("x 2015-01-27 c")
    assert l.creation_date == date(2015, 1, 27)
コード例 #16
0
def test_has_no_creation_date():
    l = Task("x c")
    assert l.creation_date == None
コード例 #17
0
def test_tags_can_separate_lumps():
    t1 = Task("a +mytag b c")
    t2 = Task("b c +mytag a")
    assert_tasks_equal(t1, t2)
コード例 #18
0
def assert_unchanged(line):
    assert Task(line).persist == line.strip()
コード例 #19
0
def test_contexts_can_separate_lumps():
    t1 = Task("a @home b c")
    t2 = Task("b c @home a")
    assert_tasks_equal(t1, t2)
コード例 #20
0
def test_can_get_completion_date():
    l = Task("x 2015-02-05 2015-01-27 c")
    assert l.completion_date == date(2015, 2, 5)
コード例 #21
0
def test_extensions_can_separate_lumps():
    t1 = Task("a prj:myprj b c")
    t2 = Task("b c prj:myprj a")
    assert_tasks_equal(t1, t2)
コード例 #22
0
def test_has_no_extensions_returns_empty_dict():
    t = Task("@home b c +mytag @whoa")
    assert t.extensions == {}
コード例 #23
0
def test_can_add_tag():
    initial = Task("x 2015-02-05 2015-01-27 c")
    target = Task("x 2015-02-05 2015-01-27 c +mytag")
    initial.add_part('+mytag')
    assert_tasks_equal(initial, target)
コード例 #24
0
def test_can_get_extensions_values():
    t = Task("@home b c h:1 +mytag @whoa")
    extension = t.extensions['h']
    assert "1" == extension.value
コード例 #25
0
def test_can_remove_part():
    initial = Task("x 2015-02-05 2015-01-27 c +mytag")
    target = Task("x 2015-02-05 2015-01-27 +mytag")
    initial.remove_part('c')
    assert_tasks_equal(initial, target)
コード例 #26
0
def test_can_get_priority():
    t = Task("(A) @home b c h:1 +mytag @whoa")
    assert "A" == t.priority.value
    assert "(A)" == t.priority.persist
コード例 #27
0
def test_can_complete():
    l = Task("c")
    l.complete()
    assert l.persist == "x c"