Skip to content

Commit

Permalink
tests: increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Nov 5, 2018
1 parent a863fff commit f67a950
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 32 deletions.
43 changes: 43 additions & 0 deletions tests/test_preproc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""Test preprocessing"""
import pathlib

import pytest

from nanite import IndentationDataSet


datadir = pathlib.Path(__file__).resolve().parent / "data"
bad_files = list(datadir.glob("bad*"))


@pytest.mark.filterwarnings('ignore::nanite.preproc.CannotSplitWarning')
def test_process_bad():
for bf in bad_files:
ds = IndentationDataSet(bf)
for idnt in ds:
# Walk through the standard analysis pipeline without
# throwing any exceptions.
idnt.apply_preprocessing(["compute_tip_position",
"correct_force_offset",
"correct_tip_offset",
"correct_split_approach_retract"])
idnt.fit_model()


def test_unknown_method():
idnt = IndentationDataSet(datadir / "spot3-0192.jpk-force")[0]
try:
idnt.apply_preprocessing(["compute_tip_position",
"unknown_method"])
except KeyError:
pass
else:
assert False, "Preprocessing with an unknown method must not work."


if __name__ == "__main__":
# Run all tests
loc = locals()
for key in list(loc.keys()):
if key.startswith("test_") and hasattr(loc[key], "__call__"):
loc[key]()
32 changes: 0 additions & 32 deletions tests/test_process_bad_files.py

This file was deleted.

0 comments on commit f67a950

Please sign in to comment.