Skip to content

Commit

Permalink
Merge pull request #22 from illya-laifu/add_missing_in_interface_file
Browse files Browse the repository at this point in the history
Add missing methods in the interface file
  • Loading branch information
illya-laifu authored Jan 1, 2025
2 parents 83c727a + c52dcda commit 2de83ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion taskchampion.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: ...
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 2de83ed

Please sign in to comment.