From 53407feb35761b5265155917ae68751f39fa85be Mon Sep 17 00:00:00 2001 From: Florian Kaiser Date: Tue, 10 Jan 2023 12:49:44 +0100 Subject: [PATCH] =?UTF-8?q?=E2=80=9Emodel.py=E2=80=9C=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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}")