forked from CAVEconnectome/EMAnnotationSchemas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_bouton_shape.py
40 lines (33 loc) · 949 Bytes
/
test_bouton_shape.py
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
import pytest
from emannotationschemas.schemas.bouton_shape import BoutonShape
good_bouton_shapes = [
{
"target_id": 1,
"shape": "pancake",
},
{
"target_id": 2,
"shape": "basmati",
},
{
"target_id": 3,
"shape": "potato",
},
]
bad_bouton_shape = {
"target_id": 4,
"shape": "hotdog",
}
def test_bouton_shape_schema():
schema = BoutonShape()
results = schema.load(good_bouton_shapes, many=True)
for index, result in enumerate(results):
assert result["target_id"] == good_bouton_shapes[index]["target_id"]
assert result["shape"] == good_bouton_shapes[index]["shape"]
def test_bad_bouton_shape():
with pytest.raises(Exception) as excinfo:
schema = BoutonShape()
result = schema.load(bad_bouton_shape)
assert "{'shape': ['Must be one of: pancake, basmati, potato.']}" in str(
excinfo.value
)