From 3e3324b01348bbef5ed03d42c4f7a9049296c2e3 Mon Sep 17 00:00:00 2001 From: Sortofamudkip <wishyutp0328@gmail.com> Date: Fri, 14 Jul 2023 00:46:35 +0200 Subject: [PATCH] fixed tests to give 100% code coverage --- .coverage | Bin 53248 -> 53248 bytes src/test_dataset.py | 7 +++++++ src/test_plotter.py | 26 +++++++++++++------------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.coverage b/.coverage index c63ebc4625ea65bb7e2925481b98b8f4036efd59..79d0a9dc4438303df4354b7f7e0d25d4aa2e31ef 100644 GIT binary patch delta 369 zcmZozz}&Eac>{|BA1iMR1Ai6Y2fl3HXS^|+1qHl#nH$+zCs+E{@}?w~Bo?QZ=oM5p zGO<j~_iLG)=T|v7$DfCh2`Jyr-pI_z!qCJ$xz@i#Ha<QxFS8^*9;ld$fq{XQH<p1f zhxa*uHE%56N1(CZyptctb~3U~&W&rCoD)|KG=__vxsijVNth96Kr=g2BQr}AHz&w2 z4wzw^|HiW`@UiljGVuT8f5g9qe*%9g(5z(sdP!CmMotsfN2f3UbbopI<(EvofB$#> ziJ7zKq`eXgP|A&^u8zBbwPE+;a`uMZJ7-_EX1K%n;N85(|5+Hy%b)8o1Jy(^pKJL2 zm#N@w*!%xh4gbGe9k|JK=dAdFdhUkb`x#;!*+0ZH#;`vqmlkCLs@7rJ_0-q;=l_%U zs`dWMnVh$LF2l;m!pX_U1okigeFpyD{9pLr@;~Fh4|L;Mes(sXE=E??&Cljb82|u! Cu!B4R delta 311 zcmZozz}&Eac>{|B4-4-j2L3X>k9;}2k2VVmT;gSJWM`Qi@7p;!*RPT{ASb`1B(+Gd zpt6yPX>y)l3nL>?u6A;PKbHU(0|NsK?_&nOPkgz&kNL}ix-auij*ab{oE=xqjnK(F zIVY}#jR|OMlknt1ztYLs{`{K~SQL0z`0E+?U-9qbpUGbj)SS;>FTujX$Z5p#==9~E z?k_LD{F15nuU^kyT;0D;nHebK!CY6z-N4#V-FIJ>;oY-5zxNCU><!iLEdTj46r8tx zuEhjY6vlL};rCyrg51^L>tzr8ua<p~!}#vmZiXHIxethzF#H!iP|8rZol%65g_Bcf y*Hd5XnQ!jzuh;u;a^6ztxeVA-{LdKpfAfFgf6M<2=&o!0lkd-G-TZpKr~v?$=yLP` diff --git a/src/test_dataset.py b/src/test_dataset.py index 97cad41..87d66df 100644 --- a/src/test_dataset.py +++ b/src/test_dataset.py @@ -100,6 +100,8 @@ def test_catch_non_dataframe(the_dataset: Dataset, param): the_dataset.get_combined_anxiety_score(param) with pytest.raises(ValueError): the_dataset.get_is_narcissist_col(param) + with pytest.raises(ValueError): + the_dataset.treat_outliers(True, "GAD_T") @pytest.mark.parametrize( @@ -138,6 +140,9 @@ def test_catch_colname_not_in_df(the_dataset: Dataset): with pytest.raises(KeyError): the_dataset.get_sorted_column("GAAAD_T") + with pytest.raises(KeyError): + the_dataset.treat_outliers(the_dataset.get_dataframe(), "GAAAD_T") + def test_catch_colname_not_string(the_dataset: Dataset): """Tests that functions that take colname correctly @@ -148,3 +153,5 @@ def test_catch_colname_not_string(the_dataset: Dataset): the_dataset.get_sorted_column(True) with pytest.raises(ValueError): the_dataset.get_unique_column_values(True) + with pytest.raises(ValueError): + the_dataset.treat_outliers(the_dataset.get_dataframe(), True) diff --git a/src/test_plotter.py b/src/test_plotter.py index 75441fc..daf8bdc 100644 --- a/src/test_plotter.py +++ b/src/test_plotter.py @@ -34,6 +34,18 @@ def test_catch_colname_not_in_df(the_plotter: Plotter): catch colnames not in dataset.""" with pytest.raises(KeyError): the_plotter.distribution_plot("GAAAD_T") + with pytest.raises(KeyError): + the_plotter.plot_categorical_bar_chart("bad_col", "GAD_T") + with pytest.raises(KeyError): + the_plotter.plot_categorical_bar_chart("GAD_T", "bad_col") + with pytest.raises(KeyError): + the_plotter.plot_categorical_histplot("bad_col", "GAD_T") + with pytest.raises(KeyError): + the_plotter.plot_categorical_histplot("GAD_T", "bad_col") + with pytest.raises(KeyError): + the_plotter.plot_scatterplot("bad_col", "GAD_T") + with pytest.raises(KeyError): + the_plotter.plot_scatterplot("GAD_T", "bad_col") def test_catch_target_not_string(the_plotter: Plotter): @@ -46,28 +58,16 @@ def test_catch_target_not_string(the_plotter: Plotter): the_plotter.plot_categorical_bar_chart(True, "GAD_T") with pytest.raises(ValueError): the_plotter.plot_categorical_bar_chart("GAD_T", True) - with pytest.raises(ValueError): - the_plotter.plot_categorical_bar_chart("GAD_TT", "GAD_T") - with pytest.raises(ValueError): - the_plotter.plot_categorical_bar_chart("GAD_T", "GAD_TT") with pytest.raises(ValueError): the_plotter.plot_categorical_histplot(True, "GAD_T") with pytest.raises(ValueError): the_plotter.plot_categorical_histplot("GAD_T", True) - with pytest.raises(ValueError): - the_plotter.plot_categorical_histplot("GAD_TT", "GAD_T") - with pytest.raises(ValueError): - the_plotter.plot_categorical_histplot("GAD_T", "GAD_TT") with pytest.raises(ValueError): the_plotter.plot_scatterplot(True, "GAD_T") with pytest.raises(ValueError): the_plotter.plot_scatterplot("GAD_T", True) - with pytest.raises(ValueError): - the_plotter.plot_scatterplot("GAD_TT", "GAD_T") - with pytest.raises(ValueError): - the_plotter.plot_scatterplot("GAD_T", "GAD_TT") @pytest.mark.parametrize( @@ -105,7 +105,7 @@ def test_distribution_plot(the_plotter: Plotter): def test_plot_categorical_bar_chart(the_plotter: Plotter): - the_plotter.plot_categorical_bar_chart("GAD_T", "SWL_T") + the_plotter.plot_categorical_bar_chart("whyplay", "SWL_T") assert True -- GitLab