-
Notifications
You must be signed in to change notification settings - Fork 34
/
test_basic.py
49 lines (40 loc) · 1.45 KB
/
test_basic.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
from ga4gh.gks.metaschema.tools.source_proc import YamlSchemaProcessor
from config import vrs_source_path, validator
# Is the YAML parseable?
p = YamlSchemaProcessor(vrs_source_path)
def test_yaml_process():
assert p.for_js, "processor loads and processes yaml"
def test_all_value_objects_with_digest_keys():
for pc in p.processed_classes:
if p.class_is_abstract(pc) or p.class_is_primitive(pc) or not p.class_is_subclass(pc, 'ValueObject'):
continue
pc_properties = set(p.defs[pc]['properties'].keys())
try:
pc_digest_keys = set(p.defs[pc]['ga4ghDigest']['keys'])
except KeyError:
if p.defs[pc]['ga4ghDigest']['assigned']:
continue
raise KeyError(f'{pc} has no keys defined.')
assert pc_digest_keys <= pc_properties
# Does the schema validate against a simple sequence location?
def test_simple_sequence_location():
sl = {
'sequenceReference': {
'refgetAccession': 'SQ.9W6SPR3RMCHWCSGJLQHE6KBOD285V5SW',
'type':'SequenceReference'
},
'start': 100,
'end': [None, 150],
'type': 'SequenceLocation'
}
validator['SequenceLocation'].validate(sl)
a = {
'location': sl,
'state': {
'type': 'ReferenceLengthExpression',
'length': [32, 35],
'repeatSubunitLength': 3
},
'type': 'Allele'
}
validator['Allele'].validate(a)