„model.py“ ändern

This commit is contained in:
Florian Kaiser 2023-01-10 12:49:44 +01:00
parent d5da356345
commit 53407feb35

View File

@ -248,7 +248,20 @@ class CaseBase:
) )
def get_values_by_field(self, field: str) -> set[str]: 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"]): if field not in list(self.fields["problem"]) + list(self.fields["solution"]):
raise ValueError(f"unknown field {field}") raise ValueError(f"unknown field {field}")