Coverage for sel_tools/utils/task.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-04 21:22 +0000

1"""Task module.""" 

2 

3from dataclasses import dataclass, field 

4from datetime import date 

5from pathlib import Path 

6 

7 

8@dataclass 

9class Task: 

10 """Student Homework Task.""" 

11 

12 title: str 

13 description: str 

14 documentation: str 

15 due_date: date | None = None 

16 label: str | None = None 

17 attachments: list[Path] = field(default_factory=list) 

18 

19 def add_homework_label(self, label: int) -> None: 

20 self.label = f"homework::{label}" 

21 

22 

23def configure_tasks(tasks: list[Task], due_date: date | None, homework_number: int) -> list[Task]: 

24 """Configure tasks.""" 

25 for task in tasks: 

26 task.due_date = due_date 

27 task.add_homework_label(homework_number) 

28 return tasks