examples/testing-demo/doctest_fail/mymath.py
def add(x, y): """ This function will add two numbers together >>> add(2, 2) 4 >>> add(3, 3) 6 >>> And here we can have more documentation. """ return x * y def multiply(x, y): return x + y # Yes, I know there are bugs in this code!
************************************************
File "mymath.py", line 5, in mymath.add
Failed example:
add(3, 3)
Expected:
6
Got:
9
************************************************
1 items had failures:
1 of 2 in mymath.add
***Test Failed*** 1 failures.
$ python -m doctest mymath.py $ echo $? 1
> python -m doctest mymath.py > echo %ERRORLEVEL% 1