-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest_examples.py
More file actions
56 lines (47 loc) · 1.43 KB
/
Copy pathtest_examples.py
File metadata and controls
56 lines (47 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""Test the RAT examples."""
import importlib
from pathlib import Path
import pytest
import ratapi.examples as examples
@pytest.mark.parametrize(
"example_name",
[
"absorption",
"domains_custom_layers",
"domains_custom_XY",
"domains_standard_layers",
"DSPC_custom_layers",
"DSPC_custom_XY",
"DSPC_standard_layers",
"DSPC_data_background",
],
)
def test_rat_examples(example_name):
"""Test that the RAT example projects run successfully."""
p, r = getattr(examples, example_name)()
assert p is not None
assert r is not None
@pytest.mark.parametrize(
"example_name",
[
"DSPC_function_background",
],
)
@pytest.mark.skipif(importlib.util.find_spec("matlab") is None, reason="Matlab not installed")
def test_function_background(example_name):
"""Test examples which rely on MATLAB engine being installed."""
p, r = getattr(examples, example_name)()
assert p is not None
assert r is not None
@pytest.mark.parametrize(
"example_name",
[
"convert_rascal",
],
)
@pytest.mark.skipif(importlib.util.find_spec("matlab") is None, reason="Matlab not installed")
def test_matlab_examples(example_name, temp_dir):
"""Test convert_rascal example, directing the output to a temporary directory."""
p, r = examples.convert_rascal(Path(temp_dir, "lipid_bilayer.mat"))
assert p is not None
assert r is not None