diff --git a/backend/model/assessment.py b/backend/model/assessment.py index e588544..7359cb6 100644 --- a/backend/model/assessment.py +++ b/backend/model/assessment.py @@ -5,7 +5,7 @@ from datetime import date from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: - from backend.model.student import Tribe + from backend.model.tribe import Tribe class Assessment: diff --git a/backend/model/student.py b/backend/model/student.py index 099cf08..06807e8 100644 --- a/backend/model/student.py +++ b/backend/model/student.py @@ -1,24 +1,10 @@ from __future__ import annotations -from dataclasses import dataclass, field +from dataclasses import dataclass from typing import TYPE_CHECKING if TYPE_CHECKING: - from backend.model.assessment import Assessment - - -@dataclass -class Tribe: - name: str - level: str - students: list[Student] = field(default_factory=list) - assessments: list[Assessment] = field(default_factory=list) - - def register_assessment(self, assessment: Assessment) -> None: - self.assessments.append(assessment) - - def register_student(self, student: Student) -> None: - self.students.append(student) + from backend.model.tribe import Tribe @dataclass diff --git a/backend/model/tribe.py b/backend/model/tribe.py new file mode 100644 index 0000000..a11516d --- /dev/null +++ b/backend/model/tribe.py @@ -0,0 +1,22 @@ +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from backend.model.assessment import Assessment + from backend.model.student import Student + + +@dataclass +class Tribe: + name: str + level: str + students: list[Student] = field(default_factory=list) + assessments: list[Assessment] = field(default_factory=list) + + def register_assessment(self, assessment: Assessment) -> None: + self.assessments.append(assessment) + + def register_student(self, student: Student) -> None: + self.students.append(student) diff --git a/tests/model/tools.py b/tests/model/fakes.py similarity index 98% rename from tests/model/tools.py rename to tests/model/fakes.py index 611be09..a27f8f3 100644 --- a/tests/model/tools.py +++ b/tests/model/fakes.py @@ -3,7 +3,7 @@ from random import choice, randint from faker import Faker from backend.model.assessment import Assessment, Domain, Exercise, Question, Skill -from backend.model.student import Tribe +from backend.model.tribe import Tribe faker = Faker() diff --git a/tests/model/test_assessment.py b/tests/model/test_assessment.py index d66d016..358d80e 100644 --- a/tests/model/test_assessment.py +++ b/tests/model/test_assessment.py @@ -1,6 +1,6 @@ from random import choice, randint -from .tools import ( +from .fakes import ( build_tribe_assessment_exercise, build_tribe_assessment_exercise_question, ) diff --git a/tests/model/test_student.py b/tests/model/test_student.py index b31bc9e..29c396a 100644 --- a/tests/model/test_student.py +++ b/tests/model/test_student.py @@ -1,7 +1,8 @@ from random import randint -from backend.model.student import Student, Tribe -from tests.model.tools import build_tribe_assessment +from backend.model.student import Student +from backend.model.tribe import Tribe +from tests.model.fakes import build_tribe_assessment def test_tribe_register_assessment():