diff --git a/unittests/test_yaml_model_parser.py b/unittests/test_yaml_model_parser.py index e3e9a0afed97511ce6a2edd33e78b4d225abdd33..cf999789766d625aaac95ba664506a9143108d66 100644 --- a/unittests/test_yaml_model_parser.py +++ b/unittests/test_yaml_model_parser.py @@ -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):