-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
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
Example of how to handle an exception #16
Comments
@jruere - It's been a while since I've worked on this project. Can you paste in an example of what you're trying to accomplish? |
Test that for a = 0, an exception is raised. |
You can assert that an assertion was raised:
https://github.com/mdwhatcott/pyspecs/blob/master/tests/test_should.py#L108 Conversely, you should be able to chain
https://github.com/mdwhatcott/pyspecs/blob/master/tests/test_should.py#L20 |
And how to I pass arguments? Should I use a lambda? You have not worked lately on the project because you are using something else? |
Yes, if the function receives arguments, wrap it in a lambda or a separate niladic function. I'm not doing very much python work right now, other than quick scripts that don't stick around long. I'm doing a lot more in Go (I also created GoConvey, also a testing tool, but with a lot more going on). Honestly, if I was doing serious python work (in python 3+) I would probably use Contexts--it's basically what I was trying to come up with in the beginning, but he did a better job :) |
Thanks for the answer. Context is nice but it has a few things I dislike:
PyVows is good although rather verbose and uses gevent for some reason... I'll stick with pyspecs for a while longer. Thanks for this! |
You're welcome. Glad you are finding this project useful. |
Hi! I couldn't find an example on how to handle an exception.
Is it already somewhere?
The text was updated successfully, but these errors were encountered: