Commit 76a9ed2f authored by Kyle Larsen's avatar Kyle Larsen
Browse files

Added tests.

parent d482cffe
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
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)
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment