Skip to content

Instantly share code, notes, and snippets.

@miebach
Created April 3, 2013 08:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miebach/5299537 to your computer and use it in GitHub Desktop.
Save miebach/5299537 to your computer and use it in GitHub Desktop.
python 2.x doctest file pattern
#!/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