forked from CAVEconnectome/EMAnnotationSchemas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_cell_types.py
More file actions
30 lines (22 loc) · 800 Bytes
/
test_cell_types.py
File metadata and controls
30 lines (22 loc) · 800 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
from emannotationschemas.schemas.cell_type_local import CellTypeLocal
good_ivscc_cell_type = {
"classification_system": "ivscc_m",
"cell_type": "spiny_4",
"pt": {"position": [1, 2, 3]},
}
bad_classical_cell_type = {
"classification_system": "classical",
"cell_type": "spiny_4",
"pt": {"position": [5, 2, 3]},
}
def annotation_import(item):
item["supervoxel_id"] = 5
item.pop("rootId", None)
def test_cell_type_validation():
schema = CellTypeLocal(context={"bsp_fn": annotation_import})
result = schema.load(good_ivscc_cell_type)
assert result["pt"]["supervoxel_id"] == 5
def test_cell_type_invalid():
schema = CellTypeLocal(context={"bsp_fn": annotation_import})
result = schema.load(bad_classical_cell_type)
assert not result["valid"]