Skip to content

Commit

Permalink
fix: add missing method in Task stub
Browse files Browse the repository at this point in the history
  • Loading branch information
illya-laifu committed Jan 1, 2025
1 parent 5923b75 commit c52dcda
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions taskchampion.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -84,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: ...
Expand Down
19 changes: 16 additions & 3 deletions tests/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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

Expand Down Expand Up @@ -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"

0 comments on commit c52dcda

Please sign in to comment.