Last active
December 29, 2015 16:39
-
-
Save pokoli/7698581 to your computer and use it in GitHub Desktop.
Catching exceptions on doctest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Testing expected exceptions | |
| >>> from exceptions import UserError | |
| >>> try: | |
| ... someOperation() | |
| ... except UserError as e: | |
| ... e.message | |
| u'ExpectedMessage' | |
| >>> # continue test | |
| #Debugging | |
| >>> try: | |
| ... someOperation() | |
| ... except: | |
| ... import pdb; pdb.set_trace() | |
| >>> # continue as normal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment