def myfun(a, b): """ >>> myfun(2,3) 5 >>> myfun(4,3) 7 """ return a+b if __name__ == '__main__': import doctest doctest.testmod()
Thursday, April 25, 2013
Doctest in python
The doctest module searches for pieces of text that look like interactive Python sessions in docstrings, and then executes those sessions to verify that they work exactly as shown.
If test failed it will shows proper message.
Posted by
Abu Zahed Jony
at
1:51 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment