refact: move Tribe to own file and rename tools to fakes
This commit is contained in:
parent
67b9a1e8a0
commit
4f4fc53253
@ -5,7 +5,7 @@ from datetime import date
|
|||||||
from typing import TYPE_CHECKING, Optional
|
from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from backend.model.student import Tribe
|
from backend.model.tribe import Tribe
|
||||||
|
|
||||||
|
|
||||||
class Assessment:
|
class Assessment:
|
||||||
|
@ -1,24 +1,10 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from backend.model.assessment import Assessment
|
from backend.model.tribe import Tribe
|
||||||
|
|
||||||
|
|
||||||
@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)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
22
backend/model/tribe.py
Normal file
22
backend/model/tribe.py
Normal file
@ -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)
|
@ -3,7 +3,7 @@ from random import choice, randint
|
|||||||
from faker import Faker
|
from faker import Faker
|
||||||
|
|
||||||
from backend.model.assessment import Assessment, Domain, Exercise, Question, Skill
|
from backend.model.assessment import Assessment, Domain, Exercise, Question, Skill
|
||||||
from backend.model.student import Tribe
|
from backend.model.tribe import Tribe
|
||||||
|
|
||||||
faker = Faker()
|
faker = Faker()
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
from random import choice, randint
|
from random import choice, randint
|
||||||
|
|
||||||
from .tools import (
|
from .fakes import (
|
||||||
build_tribe_assessment_exercise,
|
build_tribe_assessment_exercise,
|
||||||
build_tribe_assessment_exercise_question,
|
build_tribe_assessment_exercise_question,
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
from backend.model.student import Student, Tribe
|
from backend.model.student import Student
|
||||||
from tests.model.tools import build_tribe_assessment
|
from backend.model.tribe import Tribe
|
||||||
|
from tests.model.fakes import build_tribe_assessment
|
||||||
|
|
||||||
|
|
||||||
def test_tribe_register_assessment():
|
def test_tribe_register_assessment():
|
||||||
|
Loading…
Reference in New Issue
Block a user