Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nic
gridsource
Commits
93fb5bdb
Commit
93fb5bdb
authored
Nov 23, 2020
by
Nic
Browse files
test that '<<' definitions can be wrapped in any header
parent
41f7461d
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/data/test_04_IMP.yaml
View file @
93fb5bdb
---
_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
tests/test_validation.py
View file @
93fb5bdb
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment