In Python (3.3.2) doctest, ellipsis (...
) can match any string. So, for the code below
def foo():
"""
>>> foo()
hello ...
"""
print("hello world")
when running doctest it shouldn't raise any error. But
$ python -m doctest foo.py
**********************************************************************
File "./foo.py", line 3, in foo.foo
Failed example:
foo()
Expected:
hello ...
Got:
hello world
**********************************************************************
1 items had failures:
1 of 1 in foo.foo
***Test Failed*** 1 failures.
What I must do to enable the ellipis? As far as I can tell it is disable by default.
I know that add # doctest: +ELLIPSIS
, as in the code below, solve it, but I like to enable ellipsis for all tests.
def foo():
"""
>>> foo() # doctest: +ELLIPSIS
hello ...
"""
print("hello world")