Add a first unit test
This checks that the server can start and perform an autofocus. Autofocus in turn will test the camera and stage dependencies.
This commit is contained in:
parent
bccb1ee923
commit
58066f1948
11 changed files with 22 additions and 1700 deletions
|
|
@ -1,31 +0,0 @@
|
|||
import numpy as np
|
||||
|
||||
from openflexure_microscope import utilities
|
||||
|
||||
|
||||
def test_serialise_array_b64():
|
||||
shape_in = (3, 2)
|
||||
arr_in = np.random.randint(100, size=shape_in, dtype=np.int32)
|
||||
|
||||
b64_string, dtype, shape = utilities.serialise_array_b64(arr_in)
|
||||
assert b64_string
|
||||
assert dtype == "int32"
|
||||
assert shape == shape_in
|
||||
|
||||
arr_out = utilities.deserialise_array_b64(b64_string, dtype, shape)
|
||||
assert np.array_equal(arr_out, arr_in)
|
||||
|
||||
|
||||
def test_ndarray_to_json():
|
||||
shape_in = (3, 2)
|
||||
arr_in = np.random.randint(100, size=shape_in, dtype=np.int32)
|
||||
|
||||
json_out = utilities.ndarray_to_json(arr_in)
|
||||
|
||||
arr_out = utilities.json_to_ndarray(json_out)
|
||||
assert np.array_equal(arr_out, arr_in)
|
||||
|
||||
|
||||
def test_axes_to_array():
|
||||
dict_in = {"x": 1, "y": 2, "z": 3}
|
||||
assert utilities.axes_to_array(dict_in) == [1, 2, 3]
|
||||
Loading…
Add table
Add a link
Reference in a new issue