diff --git a/model.py b/model.py index e6711c0..6fa45d5 100644 --- a/model.py +++ b/model.py @@ -248,7 +248,20 @@ class CaseBase: ) def get_values_by_field(self, field: str) -> set[str]: - + """ + get the distinct values by the fields + + Args: + self: List with corresponding values + field: a string value that must be contained in self + + Returns: + the distinct values + + Raises: + ValueError: if the field value not in the 'problem' or 'solution' list + """ + if field not in list(self.fields["problem"]) + list(self.fields["solution"]): raise ValueError(f"unknown field {field}")