Limit the usage of assert
The assert
should be used to detect potential errors in the code that should actually never happen. Also it can test the expected behavior of the code. It should not be used to check inputs or parameters (types, values, etc.) passed by a caller.
In the current main branch there are some cases of assert
where custom exception classes should be used together with try: except:
instead of assert
.
@nd2853 Thanks for indicating the issue!
Edited by Ivan Kondov