Skip to content

Commit 50b6822

Browse files
authored
CI: Add csl-citation.json test (#233)
Adds a test, primarily to ensure csl-data import is working correctly. Closes #226
1 parent 2622b06 commit 50b6822

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/schemas/input/test_json.py

+26
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ def csl_data_validator():
4444
return Validator(schema)
4545

4646

47+
@pytest.fixture
48+
def csl_citation_validator():
49+
text = root.joinpath('schemas/input/csl-citation.json').read_text()
50+
schema = json.loads(text)
51+
Validator = jsonschema.validators.validator_for(schema)
52+
return Validator(schema)
53+
54+
4755
"""
4856
The following section contains the tests.
4957
"""
@@ -83,6 +91,24 @@ def test_basic_data_schema_validates(csl_data_validator):
8391
csl_data_validator.validate(csl)
8492

8593

94+
def test_basic_citation_schema_validates(csl_citation_validator):
95+
cite = {
96+
"schema": "https://resource.citationstyles.org/schema/latest/input/json/csl-citation.json",
97+
"citationID": "item1",
98+
"citationItems": [
99+
{
100+
"id": "item1",
101+
"itemData": {
102+
"id": "item1",
103+
"type": "book",
104+
"title": "test title"
105+
}
106+
}
107+
]
108+
}
109+
csl_citation_validator.validate(cite)
110+
111+
86112
def test_basic_data_schema_with_author_validates(csl_data_validator):
87113
csl = [{
88114
'id': 'example-id',

0 commit comments

Comments
 (0)