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

added/modified tests to get 100% Dataset.py code coverage

parent c746530b
No related branches found
No related tags found
1 merge request!12Merge "Write tests" branch into master
This commit is part of merge request !12. Comments created here will be created in the context of that merge request.
......@@ -49,6 +49,13 @@ def test_combined_anxiety_score(the_dataset: Dataset):
assert anxiety_scores.max() <= 1
def test_get_unique_column_values(the_dataset: Dataset):
"""Tests Dataset.get_combined_anxiety_score()."""
dataframe = the_dataset.get_dataframe()
unique_vals = the_dataset.get_unique_column_values("whyplay")
assert True
def test_get_is_narcissist_col(the_dataset: Dataset):
"""Tests Dataset.get_is_narcissist_col()."""
dataframe = the_dataset.get_dataframe()
......@@ -81,11 +88,17 @@ def test_catch_non_dataframe(the_dataset: Dataset, param):
"""
with pytest.raises(ValueError):
the_dataset.preprocess_dataset(param)
with pytest.raises(ValueError):
the_dataset.get_is_competitive_col(param)
with pytest.raises(ValueError):
the_dataset._drop_unnecessary_columns(param)
with pytest.raises(ValueError):
the_dataset.remove_nonaccepting_rows(param)
with pytest.raises(ValueError):
the_dataset.preprocess_whyplay(param)
with pytest.raises(ValueError):
the_dataset.get_combined_anxiety_score(param)
with pytest.raises(ValueError):
the_dataset.get_is_narcissist_col(param)
......@@ -100,6 +113,7 @@ def test_catch_non_bool(the_dataset: Dataset, param):
columns_set = set(dataframe.columns)
with pytest.raises(ValueError):
the_dataset.get_category_counts("GAD_T", param)
with pytest.raises(ValueError):
the_dataset.get_sorted_column("GAD_T", param)
......@@ -121,4 +135,16 @@ 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")
with pytest.raises(KeyError):
the_dataset.get_sorted_column("GAAAD_T")
def test_catch_colname_not_string(the_dataset: Dataset):
"""Tests that functions that take colname correctly
catch colnames not in dataset."""
with pytest.raises(ValueError):
the_dataset.get_category_counts(True)
with pytest.raises(ValueError):
the_dataset.get_sorted_column(True)
with pytest.raises(ValueError):
the_dataset.get_unique_column_values(True)
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