Skip to content

Raising an error instead of using assert #1

Description

@heborras

Hi,

just recently I worked a bit with pyik.
This is more of an improvement than an actual issue.
Looking through the source code I noticed that some functions use assert to verify that an input variable has the correct format. Here, I think raising an error would be more appropriate. An error message can contain the same infos and the error type can be more specific. Additionally: Asserts get turned off when Python is run with the optimization option turned on. As such asserts are okay for testing, but not for sanitizing input variables. Some functions even raise an AssertionError, instead of using assert directly, which I found surprising.

Also this would be a good chance to add further Tests to the current test suit.

And if it's okay, I would like to try to implement this change and submit it as a pull request.

Cheers,
Hendrik

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions