Created
January 7, 2013 07:28
-
-
Save goodwillcoding/4473118 to your computer and use it in GitHub Desktop.
This file contains 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
class FooError(Exception): pass | |
def public_api1(x): | |
""" | |
Return given value, after making sure it is not 1. | |
:param x: value: | |
:type x: int | |
:raises: ForError if x == 1 | |
:return: x if not equal to 1 | |
:rtype: int | |
""" | |
if x == 1: | |
raise FooError('x is 1') | |
return x | |
def public_api2(x): | |
""" | |
Return given value after adding 5 to it, unless x == 1. | |
:param x: value: | |
:type x: int | |
:raises: ForError if x == 1 | |
:return: x if not equal to 1 | |
:rtype: int | |
""" | |
# this may raise FooError | |
public_api1(x) | |
x = x + 5 | |
return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment