-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a863fff
commit f67a950
Showing
2 changed files
with
43 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]() |
This file was deleted.
Oops, something went wrong.