[Python] Can Python doctest ignore some output lines?

Discussão em 'Python' iniciado por Stack, Junho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'd like to write a doctest like this:

    """
    >>> print a.string()
    foo : a
    bar : b
    date : <I don't care about the date output>
    baz : c
    """


    Is there any way to do this? I think it would make more sense to switch to unittest, but I'm curious whether it's possible to specify a range of output that shouldn't be matched for the test in doctest.

    Continue reading...

Compartilhe esta Página