1

Ellispis does not seem to work to ignore the whole output line. I'd like to ignore everything that is outputed by foo:

def foo():
    """                                                                                
    >>> foo() # doctest: +ELLIPSIS                                                     
    ...                                                                          
    """
    print("IGNORE ME")

if __name__ == '__main__':
    import doctest
    doctest.testmod()

Running with python3 gives:

Failed example:
    foo() # doctest: +ELLIPSIS
Expected nothing
Got:
    IGNORE ME
**********************************************************************
1 items had failures:
   1 of   1 in __main__.foo
***Test Failed*** 1 failures.

Note that ignoring only part of the output works. Adding a character before ... (here "-"):

def foo():
    """                                                                                
    >>> foo() # doctest: +ELLIPSIS                                                     
    -...                                                                          
    """
    print("-IGNORE ME")

if __name__ == '__main__':
    import doctest
    doctest.testmod()
Thomas Vincent
  • 158
  • 1
  • 6
  • Possible duplicate of [Can python doctest ignore some output lines?](https://stackoverflow.com/questions/1024411/can-python-doctest-ignore-some-output-lines) – norok2 Aug 14 '19 at 13:37
  • The question [Can python doctest ignore some output lines?](https://stackoverflow.com/questions/1024411/can-python-doctest-ignore-some-output-lines) treats **some** lines among others, that indeed works well. Here it's about the **whole** output. – Thomas Vincent Aug 15 '19 at 14:06

0 Answers0