Skip to content
Snippets Groups Projects

Merge "Write tests" branch into master

Merged Wishyut (Jake Pita) requested to merge 18-write-tests into master
1 file
+ 26
0
Compare changes
  • Side-by-side
  • Inline
+ 26
0
@@ -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)
Loading