Python Module With Doctest
Any good python code should be written as a module and if possible it should include some tests - doctests (see article on Wikipedia: [1]) are awesome! Download the template as a file from: [2]
See also a longer example in Python Doctest And Docstring.
#!/usr/bin/env python
"Minimal Python Module with doctest."
def hello():
"""
Say hello.
>>> hello()
Hello World!
"""
print "Hello World!"
if __name__ == '__main__':
import doctest
doctest.testmod()
print "Tests done."
This page belongs in Kategori Mallar
This page belongs in Kategori Test