Skip to content
Snippets Groups Projects
Commit 340e5774 authored by Marek Wiesner's avatar Marek Wiesner
Browse files

Fix checks for None

parent a56d960c
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ def get_constraints_status(modelFileName: Path, dataset: Dataset) -> tuple[bool,
logging.warning(f"{dataset.name}: {err}. Indicate parsing error and return invalid constraints status.")
return readingPcompModelWasNotSuccessfulFlag, False
assert pcompModel.functions.constraints
assert pcompModel.functions.constraints is not None
if any_function_contains_symbols(pcompModel.functions.constraints, pcompModel.variables.states):
logging.warning(f"{dataset.name}: Constraints depend on states. Return invalid constraints status.")
......@@ -63,7 +63,7 @@ def get_constraints_status(modelFileName: Path, dataset: Dataset) -> tuple[bool,
logging.warning(f"{dataset.name}: Constraints depend on time. Return invalid constraints status.")
return readingPcompModelWasSuccessfulFlag, False
if (pcompModel.variables.concentration
if (pcompModel.variables.concentration is not None
and any_function_contains_symbols(pcompModel.functions.constraints, [pcompModel.variables.concentration])):
logging.warning(f"{dataset.name}: Constraints depend on concentration. Return invalid constraints status.")
return readingPcompModelWasSuccessfulFlag, False
......
......@@ -254,7 +254,7 @@ def read_measurements_to_dataset(linesIt: Iterator[str], dataset: Dataset) -> It
timePoints.append(values[0])
if hasConcentration:
if concentrationValue:
if concentrationValue is not None:
if concentrationValue != values[1]:
raise MeasurementInconsistencyError(f"{dataset.name}: Measurements dimensions inconsistent")
else:
......
......@@ -29,7 +29,7 @@ def to_cpp_array_of_constraints_infos(constraintsInfos: List[ConstraintInfo]) ->
def to_cpp_optional(value: Optional[float]) -> str:
if not value:
if value is None:
return "{}"
return f"{value}"
......
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