diff --git a/.github/workflows/run-tox.yml b/.github/workflows/run-tox.yml index f0eea653..aeb8f1ec 100644 --- a/.github/workflows/run-tox.yml +++ b/.github/workflows/run-tox.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.7, 3.8] steps: - uses: actions/checkout@v2 @@ -28,10 +28,10 @@ jobs: run: | tox - name: Upload to codecov - if: ${{matrix.python-version == '3.6'}} + if: ${{matrix.python-version == '3.8'}} uses: codecov/codecov-action@v1 with: fail_ci_if_error: false files: ./coverage.xml flags: pytest - name: "neurom-py36" + name: "neurom-py38" diff --git a/neurom/stats.py b/neurom/stats.py index f59c3921..350172b6 100644 --- a/neurom/stats.py +++ b/neurom/stats.py @@ -52,8 +52,9 @@ def get_test(stest): """Returns the correct stat test.""" sts = {StatTests.ks: 'ks_2samp', StatTests.wilcoxon: 'wilcoxon', StatTests.ttest: 'ttest_ind'} - if stest in StatTests: + if stest in sts: return sts[stest] + raise TypeError('Statistical test not recognized. Choose from ks, wilcoxon, ttest.') diff --git a/tests/test_stats.py b/tests/test_stats.py index 6496eb9c..0e1200b3 100644 --- a/tests/test_stats.py +++ b/tests/test_stats.py @@ -92,6 +92,19 @@ def test_optimal_distribution_uniform(): assert optimal.type == 'uniform' +def test_get_test(): + + stat_test_enums = (st.StatTests.ks, st.StatTests.wilcoxon, st.StatTests.ttest) + expected_stat_test_strings = ("ks_2samp", "wilcoxon", "ttest_ind") + + for i, stat_test in enumerate(stat_test_enums): + assert st.get_test(stest=stat_test) == expected_stat_test_strings[i] + + # stest does not exist in the available tests defined within the function + with pytest.raises(TypeError): + st.get_test(stest="UNKNOWN") + + def test_fit_results_dict_uniform(): a = st.FitResults(params=[1, 2], errs=[3,4], type='uniform') d = st.fit_results_to_dict(a) diff --git a/tox.ini b/tox.ini index 391c47d0..4f88097b 100644 --- a/tox.ini +++ b/tox.ini @@ -6,17 +6,17 @@ testdeps = [tox] envlist = - {py36,py37,py38} - py36-lint - py36-coverage - py36-docs + {py37,py38} + py38-lint + py38-coverage + py38-docs [testenv] deps = {[base]testdeps} extras = plotly commands = pytest tests -[testenv:py36-lint] +[testenv:py38-lint] deps = pycodestyle pydocstyle @@ -27,7 +27,7 @@ commands = pydocstyle --match-dir='(?!test).*' {toxinidir}/neurom pylint --rcfile=pylintrc --extension-pkg-whitelist=numpy --ignore=tests neurom -[testenv:py36-coverage] +[testenv:py38-coverage] deps = {[base]testdeps} pytest-cov @@ -38,7 +38,7 @@ commands = --cov-fail-under=100 \ --cov-report=xml -[testenv:py36-docs] +[testenv:py38-docs] changedir = doc extras = docs commands = @@ -58,6 +58,5 @@ convention = google [gh-actions] python = - 3.6: py36, py36-plotly, py36-lint, py36-docs, py36-coverage 3.7: py37 3.8: py38