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

added tests for new code (100% coverage)

parent c48fe587
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -145,7 +145,10 @@ def test_catch_colname_not_in_df(the_dataset: Dataset):
the_dataset.get_category_counts("GAAAD_T")
with pytest.raises(KeyError):
the_dataset.get_sorted_column("GAAAD_T")
with pytest.raises(KeyError):
the_dataset.get_column_mean("GAAAD_T")
with pytest.raises(KeyError):
the_dataset.filtered_rows("GAAAD_T", 5)
with pytest.raises(KeyError):
the_dataset.treat_outliers(the_dataset.get_dataframe(), "GAAAD_T")
......@@ -161,3 +164,37 @@ def test_catch_colname_not_string(the_dataset: Dataset):
the_dataset.get_unique_column_values(True)
with pytest.raises(ValueError):
the_dataset.treat_outliers(the_dataset.get_dataframe(), True)
with pytest.raises(ValueError):
the_dataset.get_column_mean(True)
with pytest.raises(ValueError):
the_dataset.filtered_rows(True, "7")
def test_get_column_count(the_dataset: Dataset):
"""Tests that get_column_count works correctly."""
assert the_dataset.get_column_count() == 20
def test_get_row_count(the_dataset: Dataset):
"""Tests that get_row_count works correctly."""
assert the_dataset.get_row_count() == 12838
def test_get_column_mean(the_dataset: Dataset):
"""Tests that get_column_mean works correctly."""
assert the_dataset.get_column_mean("GAD_T") == pytest.approx(5.17557)
def test_filtered_rows(the_dataset: Dataset):
"""Tests that filtered_rows works correctly."""
assert len(the_dataset.filtered_rows("GAD_T", 5.0)) == 976
assert len(the_dataset.filtered_rows("SWL_T", 0.0)) == 0
assert len(the_dataset.filtered_rows("whyplay", "improving")) == 4661
def test_get_columns(the_dataset: Dataset):
"""Tests that get_columns works correctly."""
columns = the_dataset.get_columns()
assert "SWL_T" in columns
assert "GAD_T" in columns
assert "whyplay" in columns
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