Skip to content

Replaced most assertions in favor of error handling

Karsten Prehn requested to merge hotfix/assertions into main

assert statements can be disabled with python's -O flag (from Python's help: -O : remove assert and __debug__-dependent statements [...]), so they are not suited for flow-control or plausibility checks. That's also in line with other programming languages. Therefore I replaced most assert checks with proper if-statements.

I left assertions in the pytest files and where I think they help with understanding the state or purpose of a variable.

\approve @ds @marius

Edited by Karsten Prehn

Merge request reports

Loading