Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
kylelars
Multipoint force-deflection analysis
Commits
76a9ed2f
Commit
76a9ed2f
authored
Jul 12, 2022
by
Kyle Larsen
Browse files
Added tests.
parent
d482cffe
Changes
4
Hide whitespace changes
Inline
Side-by-side
pyMFD/tests/__init__.py
0 → 100644
View file @
76a9ed2f
pyMFD/tests/test_FV.py
0 → 100644
View file @
76a9ed2f
import
pytest
from
pyMFD.FV
import
FV
def
test_FV
():
spm_file
=
"data/examples/02041411.001"
fv
=
FV
(
spm_file
)
(
comp
,
_
)
=
fv
.
summarize
()
px_size
=
fv
.
get_pixel_size
()
assert
fv
.
tm_defl
.
shape
==
(
1024
,
2
,
4096
)
assert
comp
.
shape
==
(
64
,
64
)
assert
px_size
==
pytest
.
approx
(
2.34375e-07
)
\ No newline at end of file
pyMFD/tests/test_nanoscope.py
0 → 100644
View file @
76a9ed2f
import
pytest
import
struct
from
pyMFD.nanoscope
import
get_fv_data
,
get_params
,
save_txt_data
### get_fv_data ###
# Tests get_fv_data, read_fv_data, convert_fv_data, get_params, read_fv_header, and convert_params
def
test_get_fv_data
():
filename
=
"data/examples/02041411.001"
params
=
get_params
(
filename
)
data
=
get_fv_data
(
filename
,
params
)
assert
data
is
not
None
and
params
is
not
None
def
test_get_fv_data_not_exist
():
with
pytest
.
raises
(
FileNotFoundError
)
as
e_info
:
filename
=
"data/examples/02041411.001"
params
=
get_params
(
filename
)
data
=
get_fv_data
(
"this_file_should_not_exist.fn238ty0asd9"
,
params
)
def
test_get_fv_data_bad_filetype
():
with
pytest
.
raises
(
struct
.
error
)
as
e_info
:
filename
=
"data/examples/02041411.001"
params
=
get_params
(
filename
)
data
=
get_fv_data
(
"data/examples/02041411.001.json"
,
params
)
pyMFD/tests/test_scan_params.py
0 → 100644
View file @
76a9ed2f
from
pyMFD.scan_params
import
get_scan_params
import
os
def
test_get_scan_params
():
'''Test loading scan parameters from JSON.'''
sc_params
=
get_scan_params
(
"data/examples/02041411.001.json"
)
assert
"name"
in
sc_params
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment