-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtest_utils.py
60 lines (51 loc) · 1.58 KB
/
test_utils.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from bmt.toolkit import Toolkit
import pytest
from bmt.utils import parse_name, format_element, sentencecase_to_camelcase
@pytest.fixture(scope="module")
def toolkit():
return Toolkit()
@pytest.mark.parametrize(
"query",
[
("biolink:Gene", "gene"),
("biolink:NamedThing", "named thing"),
("biolink:related_to", "related to"),
("PhenotypicFeature", "phenotypic feature"),
("related_to", "related to"),
("related to", "related to"),
("causes", "causes"),
("treats", "treats"),
("gene", "gene"),
("has_gene", "has gene"),
("biolink:GeneToGeneAssociation", "gene to gene association"),
("RNA product", "RNA product"),
("RNA Product", "RNA Product"),
("Rna Product", "Rna Product"),
("biolink:RNAProduct", "RNA product"),
],
)
def test_parse_name(query):
n = parse_name(query[0])
assert n == query[1]
@pytest.mark.parametrize(
"query",
[
("phenotypic feature", "PhenotypicFeature"),
("noncoding RNA product", "NoncodingRNAProduct"),
],
)
def test_sentencecase_to_camelcase(query):
n = sentencecase_to_camelcase(query[0])
assert n == query[1]
@pytest.mark.parametrize(
"query",
[
("related to", "biolink:related_to"),
("caused_by", "biolink:caused_by"),
("PhenotypicFeature", "biolink:PhenotypicFeature"),
("noncoding RNA product", "biolink:NoncodingRNAProduct"),
],
)
def test_format_element(query, toolkit):
n = format_element(toolkit.get_element(query[0]))
assert n == query[1]