Skip to content

Commit 312b169

Browse files
committed
..
1 parent ba406c9 commit 312b169

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

petab/v2/lint.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,10 @@ def run(self, problem: Problem) -> ValidationIssue | None:
316316
except AssertionError as e:
317317
return ValidationError(str(e))
318318

319-
# TODO: introduce some option for validation partial vs full
319+
# TODO: introduce some option for validation of partial vs full
320320
# problem. if this is supposed to be a complete problem, a missing
321321
# condition table should be an error if the measurement table refers
322-
# to conditions
323-
324-
# check that measured experiments
325-
if problem.experiment_df is None:
326-
return
327-
322+
# to conditions, otherwise it should maximally be a warning
328323
used_experiments = set(problem.measurement_df[EXPERIMENT_ID].values)
329324
# handle default-experiment
330325
used_experiments = set(
@@ -333,11 +328,14 @@ def run(self, problem: Problem) -> ValidationIssue | None:
333328
used_experiments,
334329
)
335330
)
336-
available_experiments = set(
337-
problem.experiment_df[EXPERIMENT_ID].unique()
331+
# check that measured experiments exist
332+
available_experiments = (
333+
set(problem.experiment_df[EXPERIMENT_ID].unique())
334+
if problem.experiment_df is not None
335+
else set()
338336
)
339337
if missing_experiments := (used_experiments - available_experiments):
340-
raise AssertionError(
338+
return ValidationError(
341339
"Measurement table references experiments that "
342340
"are not specified in the experiments table: "
343341
+ str(missing_experiments)

0 commit comments

Comments
 (0)