Add first tests
This commit is contained in:
parent
bdfc319013
commit
1146c04a38
5 changed files with 43 additions and 0 deletions
6
beamtime/test/pytest.ini
Normal file
6
beamtime/test/pytest.ini
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# pytest.ini
|
||||||
|
|
||||||
|
[pytest]
|
||||||
|
minversion = 6.0
|
||||||
|
testpaths =
|
||||||
|
.
|
||||||
29
beamtime/test/test_auxillary.py
Normal file
29
beamtime/test/test_auxillary.py
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
import beamtime.auxillary as aux
|
||||||
|
|
||||||
|
def test_swap_values():
|
||||||
|
|
||||||
|
|
||||||
|
dict = {'test1': 1, 'test2': 2}
|
||||||
|
key1 = 'test1'
|
||||||
|
key2 = 'test2'
|
||||||
|
|
||||||
|
oldval1 = dict[key1]
|
||||||
|
oldval2 = dict[key2]
|
||||||
|
|
||||||
|
new_dict = aux.swap_values(dict=dict, key1=key1, key2=key2)
|
||||||
|
|
||||||
|
assert (dict[key1] == oldval2) and (dict[key2] == oldval1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_ceil() -> None:
|
||||||
|
|
||||||
|
assert aux.ceil(1.05, 0.5) == 1.5
|
||||||
|
assert aux.ceil(1.05, 1) == 2.0
|
||||||
|
assert aux.ceil(1.1, 0.2) == 1.2
|
||||||
|
|
||||||
|
|
||||||
|
def test_floor() -> None:
|
||||||
|
|
||||||
|
assert aux.floor(2.02, 1) == 2.0
|
||||||
|
assert aux.floor(2.02, 0.01) == 2.02
|
||||||
|
assert aux.floor(2.013, 0.01) == 2.01
|
||||||
8
beamtime/test/test_plotting.py
Normal file
8
beamtime/test/test_plotting.py
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import beamtime.plotting as btp
|
||||||
|
from cycler import cycler
|
||||||
|
import itertools
|
||||||
|
|
||||||
|
|
||||||
|
def test_generate_colours() -> None:
|
||||||
|
|
||||||
|
assert type(btp.generate_colours('black', kind='single')) == itertools.cycle
|
||||||
0
beamtime/test/xrd/test_io.py
Normal file
0
beamtime/test/xrd/test_io.py
Normal file
0
beamtime/test/xrd/test_plot.py
Normal file
0
beamtime/test/xrd/test_plot.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue