-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathtest_failures.py
36 lines (26 loc) · 1.08 KB
/
test_failures.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
"""
Tests the JSON schema
"""
import jsonschema
import pytest
import os
import test_helpers
import qcschema
### Test input validation errors
input_failures = test_helpers.list_tests("input_failures")
# Loop over all tests that should pass the tests
@pytest.mark.parametrize("testfile", input_failures[0], ids=input_failures[1])
@pytest.mark.parametrize("version", qcschema.list_versions("input"))
def test_input_failures(version, testfile):
example = test_helpers.get_test(testfile)
with pytest.raises(jsonschema.exceptions.ValidationError):
qcschema.validate(example, "input")
### Test output validation errors
output_failures = test_helpers.list_tests("output_failures")
# Loop over all tests that should pass the tests
@pytest.mark.parametrize("testfile", output_failures[0], ids=output_failures[1])
@pytest.mark.parametrize("version", qcschema.list_versions("output"))
def test_output_failures(version, testfile):
example = test_helpers.get_test(testfile)
with pytest.raises(jsonschema.exceptions.ValidationError):
qcschema.validate(example, "output")