We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e.g.
contracts.interface.ContractNotRespected: Breach for argument 'outdir' to run_sample_sheet(). Shouldn't have satisfied the clause exists. checking: !exists for value: Instance of <type 'str'>: './' checking: str,!exists for value: Instance of <type 'str'>: './' Variables bound in inner context:
Could become
contracts.interface.ContractNotRespected: Breach for argument 'outdir' to run_sample_sheet(). ===================== ERROR: blah blah blah ====================== checking: !exists for value: Instance of <type 'str'>: './' checking: str,!exists for value: Instance of <type 'str'>: './' Variables bound in inner context:
Do this by raising a ValueError rather than returning false. Example:
ValueError
def fails(x): raise ValueError("="*9 + "\nERROR: blah blah blah, do xyz\n" + "="*9) contracts.new_contract("failit", fails) contracts.decorate(lambda x: x, x="failit")(1)
I would just wrap our current boolean-returning functions
def wrap_validation(func, message): def ret_func(arg): if not func(arg): raise ValueError(message) return ret_func contracts.new_contract("is_truthy", wrap_validation(lambda x: bool(x), "Not truthy, use truthy input"))
The text was updated successfully, but these errors were encountered:
It needs to be very explicit in what is wrong, that is, it should say exactly what the issue is
Like for the !exists issue, it sould say something like
!exists
Error: Directory X already exists
Sorry, something went wrong.
This is better as a PR against the contracts library.
No branches or pull requests
e.g.
Could become
Do this by raising a
ValueError
rather than returning false. Example:I would just wrap our current boolean-returning functions
The text was updated successfully, but these errors were encountered: