Becksteinlab / kda

Python package used for the analysis of biochemical kinetic diagrams.
GNU General Public License v3.0
3 stars 1 forks source link

Replace assertion in `diagrams.enumerate_partial_diagrams()` with specific error #30

Closed nawtrey closed 1 month ago

nawtrey commented 3 years ago

The following lines in diagrams.enumerate_partial_diagrams() should be changed such that a specific error is raised:

    # get the cofactor matrix
    K_cof = _get_cofactor_matrix(K_laplace=K_laplace)
    # check that all values in the cofactor matrix are the same by
    # checking if minimum and maximum values are equal
    assert K_cof.min() == K_cof.max()

For this case it would be far better to raise an error with an error message and leave assertions for tests.

nawtrey commented 1 month ago

After reviewing this again I think I'm going to close it. If an AssertionError is raised I think the comment will be sufficient to understand the cause.