Created
April 3, 2013 08:46
-
-
Save miebach/5299537 to your computer and use it in GitHub Desktop.
python 2.x doctest file pattern
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
def f(x): | |
""" | |
returns x * x | |
>>> f(5) | |
25 | |
>>> f(-3) | |
9 | |
""" | |
return x * x | |
if __name__ == "__main__": | |
from doctest import testmod | |
testmod() # without parameter: test the current module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment