diff --git a/taskchampion.pyi b/taskchampion.pyi index f587d0d..b0bb4f3 100644 --- a/taskchampion.pyi +++ b/taskchampion.pyi @@ -3,7 +3,6 @@ from enum import Enum from typing import Optional, Iterator class Replica: - def __init__(self, path: str, create_if_missing: bool): ... @staticmethod def new_on_disk(path: str, create_if_missing: bool): ... @staticmethod @@ -85,6 +84,7 @@ class Task: def get_entry(self) -> Optional[datetime]: ... def get_priority(self) -> str: ... def get_wait(self) -> Optional[datetime]: ... + def get_description(self) -> str: ... def is_waiting(self) -> bool: ... def is_active(self) -> bool: ... def is_blocked(self) -> bool: ... diff --git a/tests/test_task.py b/tests/test_task.py index 457b6f7..0c0579c 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -45,8 +45,6 @@ def blocked_task(): task = r.create_task(str(uuid.uuid4()), ops) r.commit_operations(ops) - # Fragile test, but I cannot mock Rust's Chrono, so this will do. - # Need to refresh the tag, the one that's in memory is stale return task @@ -57,7 +55,18 @@ def due_task(): task = r.create_task(str(uuid.uuid4()), ops) task.set_due(datetime.fromisoformat("2006-05-13T01:27:27+00:00"), ops) r.commit_operations(ops) - # Need to refresh the tag, the one that's in memory is stale + + return task + + +@pytest.fixture +def task_with_description(): + r = Replica.new_in_memory() + ops = Operations() + task = r.create_task(str(uuid.uuid4()), ops) + + task.set_description("This is a description", ops) + r.commit_operations(ops) return task @@ -124,3 +133,7 @@ def test_get_modified(waiting_task: Task): def test_get_due(due_task: Task): assert due_task.get_due() == datetime.fromisoformat("2006-05-13T01:27:27+00:00") + + +def test_get_description(task_with_description): + assert task_with_description.get_description() == "This is a description"