diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b6446abe1cd8092bb03d143f902427931350f47..62773ef94aeea0560bdea0bd3effa8b3e620f915 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed ### +* The deprecated `parent` keyword from the YAML datamodel specification. Use + `inherit_from_{obligatory|recommended|suggested}` instead. + ### Fixed ### ### Security ### diff --git a/src/caosadvancedtools/models/parser.py b/src/caosadvancedtools/models/parser.py index 37f34e7bcbae48188c96b9bea6434d59571020fd..fa21aa13b1ee666a36d94280865835b922d6c721 100644 --- a/src/caosadvancedtools/models/parser.py +++ b/src/caosadvancedtools/models/parser.py @@ -52,9 +52,7 @@ from linkahead.common.datatype import get_list_datatype from .data_model import CAOSDB_INTERNAL_PROPERTIES, DataModel # Keywords which are allowed in data model descriptions. -KEYWORDS = ["parent", # deprecated, use inherit_from_* instead: - # https://gitlab.com/caosdb/caosdb-advanced-user-tools/-/issues/36 - "importance", +KEYWORDS = ["importance", "datatype", # for example TEXT, INTEGER or REFERENCE "unit", "description", @@ -595,16 +593,6 @@ debug : bool, optional self._inherit(name, prop, db.RECOMMENDED) elif prop_name == "inherit_from_suggested": self._inherit(name, prop, db.SUGGESTED) - elif prop_name == "parent": - warn( - DeprecationWarning( - "The `parent` keyword is deprecated and will be " - "removed in a future version. Use " - "`inherit_from_{obligatory|recommended|suggested}` " - "instead." - ) - ) - self._inherit(name, prop, db.OBLIGATORY) else: raise ValueError("invalid keyword: {}".format(prop_name)) diff --git a/src/doc/yaml_interface.rst b/src/doc/yaml_interface.rst index ac3914385d31df5a306b3f8400fbcb6b005f17fa..48e27802e72177424fd2c6258492b283bbff0d3b 100644 --- a/src/doc/yaml_interface.rst +++ b/src/doc/yaml_interface.rst @@ -109,7 +109,6 @@ Keywords added as parents, and all Properties with at least the importance ``XXX`` are inherited. For example, ``inherited_from_recommended`` will inherit all Properties of importance ``recommended`` and ``obligatory``, but not ``suggested``. -- **parent**: Parent of this entity. Same as ``inherit_from_obligatory``. (*Deprecated*) Usage ===== diff --git a/unittests/test_yaml_model_parser.py b/unittests/test_yaml_model_parser.py index 1019a93a0aa4292cea75fe8fba57e19e55359baa..a7f6d6b9b292a6dc064e6fa35682c40bd66c07d2 100644 --- a/unittests/test_yaml_model_parser.py +++ b/unittests/test_yaml_model_parser.py @@ -19,7 +19,7 @@ import unittest from datetime import date from tempfile import NamedTemporaryFile -from pytest import deprecated_call, raises, mark +from pytest import raises, mark import linkahead as db from caosadvancedtools.models.parser import (TwiceDefinedException, @@ -527,7 +527,7 @@ F: def test_issue_36(): - """Test whether the `parent` keyword is deprecated. + """Test whether the `parent` keyword is removed. See https://gitlab.com/caosdb/caosdb-advanced-user-tools/-/issues/36. @@ -550,17 +550,12 @@ R3: inherit_from_obligatory: - R1 """ - with deprecated_call(): - # Check whether this is actually deprecated + with raises(ValueError) as ve: + # The keyword has been removed, so it should raise a regular ValueError. model = parse_model_from_string(model_string) - assert "R3" in model - r3 = model["R3"] - assert isinstance(r3, db.RecordType) - for par in ["R1", "R2"]: - # Until removal, both do the same - assert has_parent(r3, par) - assert r3.get_parent(par)._flags["inheritance"] == db.OBLIGATORY + assert "invalid keyword" in str(ve.value) + assert "parent" in str(ve.value) def test_yaml_error():