Skip to content

Commit

Permalink
fix: enforce explicit FormModel Subclasses in BaseQuestionState
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderschmitz committed Nov 20, 2023
1 parent b62714d commit 5b67d14
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions questionpy/_qtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def export_question_state(self) -> str:
def __init_subclass__(cls, **kwargs: object) -> None:
super().__init_subclass__(**kwargs)
cls.state_class = _get_type_arg(cls, Question, 0, bound=BaseQuestionState, default=BaseQuestionState)
if _get_type_arg(cls, Question, 0) == BaseQuestionState:
raise TypeError(f"{cls.state_class.__name__} must declare a specific FormModel.")
cls.attempt_class = _get_type_arg(cls, Question, 1, bound=Attempt)


Expand Down

0 comments on commit 5b67d14

Please sign in to comment.