Skip to content
Snippets Groups Projects
Commit 3c7cb1cc authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

TST: Adapt unittest to removed parent keyword

parent 9f9aa7b8
No related branches found
No related tags found
2 merge requests!100WIP: Filling XLSX: Seems to be working.,!91F remove deprecated parent
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
import unittest import unittest
from datetime import date from datetime import date
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from pytest import deprecated_call, raises, mark from pytest import raises, mark
import linkahead as db import linkahead as db
from caosadvancedtools.models.parser import (TwiceDefinedException, from caosadvancedtools.models.parser import (TwiceDefinedException,
...@@ -527,7 +527,7 @@ F: ...@@ -527,7 +527,7 @@ F:
def test_issue_36(): 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. See https://gitlab.com/caosdb/caosdb-advanced-user-tools/-/issues/36.
...@@ -550,17 +550,12 @@ R3: ...@@ -550,17 +550,12 @@ R3:
inherit_from_obligatory: inherit_from_obligatory:
- R1 - R1
""" """
with deprecated_call(): with raises(ValueError) as ve:
# Check whether this is actually deprecated # The keyword has been removed, so it should raise a regular ValueError.
model = parse_model_from_string(model_string) model = parse_model_from_string(model_string)
assert "R3" in model assert "invalid keyword" in str(ve.value)
r3 = model["R3"] assert "parent" in str(ve.value)
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
def test_yaml_error(): def test_yaml_error():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment