Skip to content
Snippets Groups Projects
Commit cda0fa31 authored by Sortofamudkip's avatar Sortofamudkip
Browse files

colname in columns test (get_sorted_column)

parent 2a964d41
No related branches found
No related tags found
No related merge requests found
......@@ -232,6 +232,9 @@ class Dataset:
if type(colname) != str:
logging.error("parameter `colname` is not a string")
raise ValueError(f"{colname} is not a string")
if colname not in self.dataframe.columns:
logging.error("column requested not in dataframe")
raise KeyError(f"{colname} is not a column in dataframe")
if not (ascending is None or type(ascending) is bool):
logging.error("parameter `ascending` is not a bool or None")
raise ValueError(f"{ascending} is not a bool or None")
......
......@@ -121,3 +121,4 @@ def test_catch_colname_not_in_df(the_dataset: Dataset):
catch colnames not in dataset."""
with pytest.raises(KeyError):
the_dataset.get_category_counts("GAAAD_T")
the_dataset.get_sorted_column("GAAAD_T")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment