Commit 93fb5bdb authored by Nic's avatar Nic
Browse files

test that '<<' definitions can be wrapped in any header

parent 41f7461d
---
_length: &length
units: in
default: 0
_pressure: &pressure
units: psi
_mass: &mass
units: lb
_volume: &volume
units: in^3
_force: &force
units: lbf
whatever:
length: &length
units: in
default: 0
pressure: &pressure
units: psi
mass: &mass
units: lb
volume: &volume
units: in^3
force: &force
units: lbf
......@@ -385,6 +385,50 @@ def test_IVData_05_failing_units(datadir):
os.path.join(indir, "test_04_IMP.yaml"),
os.path.join(indir, "test_04_data.yaml"),
)
# -------------------------------------------------------------------------
# test tabname present in schemas, but not in data
whatever = data._schemas["whatever"].build()
assert whatever == {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"force": {
"items": {"anyOf": [{"type": "integer"}, {"type": "null"}]},
"type": "array",
"uniqueItems": False,
"units": "lbf",
},
"length": {
"items": {
"anyOf": [{"type": "integer"}, {"type": "null"}],
"default": 0,
},
"type": "array",
"uniqueItems": False,
"units": "in",
},
"mass": {
"items": {"anyOf": [{"type": "integer"}, {"type": "null"}]},
"type": "array",
"uniqueItems": False,
"units": "lb",
},
"pressure": {
"items": {"anyOf": [{"type": "integer"}, {"type": "null"}]},
"type": "array",
"uniqueItems": False,
"units": "psi",
},
"volume": {
"items": {"anyOf": [{"type": "integer"}, {"type": "null"}]},
"type": "array",
"uniqueItems": False,
"units": "in^3",
},
},
"required": [],
"type": "object",
}
expected_schema = {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
......@@ -544,12 +588,13 @@ def test_IVData_06_units(datadir):
l9_quantity_exp = 2 * ureg.m
# rendering with quantity:
l9_quantity = data_SI.getvalue("length", key=9, search_by="id", column="test_dist_yd")
l9_quantity = data_SI.getvalue(
"length", key=9, search_by="id", column="test_dist_yd"
)
diff = l9_quantity - l9_quantity_exp
assert abs(diff.magnitude) < 1e-5
def test_IVData_07_failing_units(datadir):
"""check units"""
indir, outdir = datadir
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment