forked from scverse/spatialdata-plot
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_basic.py
More file actions
35 lines (27 loc) · 986 Bytes
/
test_basic.py
File metadata and controls
35 lines (27 loc) · 986 Bytes
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
import pytest
@pytest.mark.parametrize(
"sdata, keys ",
[
("test_sdata_multiple_images", 0),
("test_sdata_multiple_images", {"a": 0}),
("test_sdata_multiple_images", None),
("test_sdata_multiple_images", ["my_key", 0]),
],
)
def test_typerror_when_key_is_invalid(sdata, keys, request):
"""Tests wether the images inside sdata can be clipped to a bounding box."""
sdata = request.getfixturevalue(sdata)
with pytest.raises(TypeError):
sdata.pp.get_elements(keys)
@pytest.mark.parametrize(
"sdata, keys ",
[
("test_sdata_multiple_images", "data4"),
("test_sdata_multiple_images", ["data1", "data4"]),
],
)
def test_valuerror_when_key_is_of_correct_type_but_not_in_sdata(sdata, keys, request):
"""Tests wether the images inside sdata can be clipped to a bounding box."""
sdata = request.getfixturevalue(sdata)
with pytest.raises(ValueError):
sdata.pp.get_elements(keys)