diff --git a/petab/v2/lint.py b/petab/v2/lint.py index 80f47b04..5748e52b 100644 --- a/petab/v2/lint.py +++ b/petab/v2/lint.py @@ -945,8 +945,8 @@ def run(self, problem: Problem) -> ValidationIssue | None: new_petab_ids = { m.petab_id for m in problem.mappings - # Ignore identity mappings used for annotation - if m.petab_id != m.model_id + # Ignore identity mappings and annotation-only rows + if m.model_id and m.petab_id != m.model_id } old_petab_ids = ( {c.id for c in problem.conditions} diff --git a/tests/v2/test_lint.py b/tests/v2/test_lint.py index aae8a5e4..65d4796f 100644 --- a/tests/v2/test_lint.py +++ b/tests/v2/test_lint.py @@ -146,6 +146,14 @@ def test_check_mapping_table(uses_pysb): check = CheckMappingTable() assert check.run(problem) is None + # Valid: mapping table is used purely for annotation + # petabEntityId appears elsewhere in the problem + problem.add_mapping(petab_id="c1", model_id=None, name="Condition 1") + problem.add_condition("c1", p2="1") + + check = CheckMappingTable() + assert check.run(problem) is None + # Invalid: petabEntityId is referenced in the model pysb.SelfExporter.cleanup() pysb_model_invalid = pysb.Model("test_model_invalid")