Skip to content
Snippets Groups Projects
Commit 18ccd72d authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

TST(data-model-parser): replaced static xml tests by more specific ones

parent 0c25885d
Branches
Tags
2 merge requests!128MNT: Added a warning when column metadata is not configured, and a better...,!115add datatype, unit and description to properties that are part of Records
Pipeline #57814 failed
......@@ -612,14 +612,13 @@ RT2:
obligatory_properties: *RT1_oblig
"""
model = parse_model_from_string(model_string)
assert str(model) == """{'foo': <Property name="foo" datatype="INTEGER"/>
, 'RT1': <RecordType name="RT1">
<Property name="foo" importance="OBLIGATORY" flag="inheritance:FIX"/>
</RecordType>
, 'RT2': <RecordType name="RT2">
<Property name="foo" importance="OBLIGATORY" flag="inheritance:FIX"/>
</RecordType>
}"""
assert len(model) == 3
assert isinstance(model["foo"], db.Property)
assert model["foo"].datatype == db.INTEGER
for st in ("RT1", "RT2"):
assert isinstance(model[st], db.RecordType)
assert model[st].get_property("foo").datatype == db.INTEGER
# Aliasing with override
model_string = """
......@@ -634,16 +633,13 @@ RT2:
bar:
"""
model = parse_model_from_string(model_string)
assert str(model) == """{'foo': <Property name="foo" datatype="INTEGER"/>
, 'RT1': <RecordType name="RT1">
<Property name="foo" importance="OBLIGATORY" flag="inheritance:FIX"/>
</RecordType>
, 'RT2': <RecordType name="RT2">
<Property name="foo" importance="OBLIGATORY" flag="inheritance:FIX"/>
<Property name="bar" importance="OBLIGATORY" flag="inheritance:FIX"/>
</RecordType>
, 'bar': <RecordType name="bar"/>
}"""
assert len(model) == 4
assert isinstance(model["bar"], db.RecordType)
for st in ("RT1", "RT2"):
assert isinstance(model[st], db.RecordType)
assert model[st].get_property("foo").datatype == db.INTEGER
assert model["RT2"].get_property("bar").datatype == "bar"
def test_comparison_yaml_model(capfd):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment