[TIP] doctests with either-or outcome

Pete Forman pete.forman at westerngeco.com
Fri Sep 26 07:02:21 PDT 2008


"Rob Kirkpatrick" <robert.d.kirkpatrick at gmail.com> writes:

 > Is there a way of having a doctest pass if it has EITHER output A
 > or output B? 

What about this approach?

>>> output = get_output()
>>> output in (output_A, output_B)
True

-- 
Pete Forman                -./\.-  Disclaimer: This post is originated
WesternGeco                  -./\.-   by myself and does not represent
pete.forman at westerngeco.com    -./\.-   the opinion of Schlumberger or
http://petef.22web.net           -./\.-   WesternGeco.




More information about the testing-in-python mailing list