Try this on a Jupyter laptop:
def my_fun(): ''' >>> 2 + 3 6 ''' pass import doctest doctest.testmod()
The result should be:
********************************************************************** File "__main__", line 3, in __main__.my_fun Failed example: 2 + 3 Expected: 6 Got: 5 ********************************************************************** 1 items had failures: 1 of 1 in __main__.my_fun ***Test Failed*** 1 failures. TestResults(failed=1, attempted=3)
(I used python 2.7.12)
source share