Skip to content

Commit

Permalink
Allow low, high, value in independent variables
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonrclarke committed Aug 5, 2021
1 parent bec110e commit e9e6e4e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions hepdata_validator/schemas/1.1.0/data_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
{
"type": "object",
"properties": {
"value": { "type": "number" },
"low": { "type": "number" },
"high": { "type": "number" }
},
Expand Down
29 changes: 27 additions & 2 deletions testsuite/test_data/valid_file.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
},
{
"value": 8000
}
},
{
"high": 9000,
"low": 7000,
"value": 8000
},
]
}
],
Expand Down Expand Up @@ -68,8 +73,28 @@
"label": "sys,lumi"
}
]
},
{
"value": 6.7,
"errors": [
{
"symerror": 0.5,
"label": "stat"
},
{
"asymerror": {
"plus": 0.24,
"minus": 0.34
},
"label": "sys"
},
{
"symerror": 0.3,
"label": "sys,lumi"
}
]
}
]
}
]
}
}
2 changes: 1 addition & 1 deletion testsuite/test_data_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def test_file_with_invalid_independent_variables_v1(validator_v1, data_path, cap

assert is_valid is False
out, err = capsys.readouterr()
assert out.strip() == "error - {'low': 6000} is not valid under any of the given schemas in 'independent_variables[0].values[0]' (expected: {'oneOf': [{'type': 'object', 'properties': {'value': {'type': ['string', 'number']}}, 'required': ['value'], 'additionalProperties': False}, {'type': 'object', 'properties': {'low': {'type': 'number'}, 'high': {'type': 'number'}}, 'required': ['low', 'high'], 'additionalProperties': False}]})"
assert out.strip() == "error - {'low': 6000} is not valid under any of the given schemas in 'independent_variables[0].values[0]' (expected: {'oneOf': [{'type': 'object', 'properties': {'value': {'type': ['string', 'number']}}, 'required': ['value'], 'additionalProperties': False}, {'type': 'object', 'properties': {'value': {'type': 'number'}, 'low': {'type': 'number'}, 'high': {'type': 'number'}}, 'required': ['low', 'high'], 'additionalProperties': False}]})"


def test_file_with_missing_dependent_values_v1(validator_v1, data_path, capsys):
Expand Down

0 comments on commit e9e6e4e

Please sign in to comment.