[TIP] doctests with either-or outcome
andrew-tip at puzzling.org
Sat Sep 27 09:15:01 PDT 2008
Michael Foord wrote:
> Pete Forman wrote:
> > What about this approach?
> >>>> output = get_output()
> >>>> output in (output_A, output_B)
> > True
> In my opinion this is one of the problems with the doctest approach.
> Should this fail you get a 'False != True' message that doesn't show you
> what the actual output was.
Of course, you can solve this problem in similar fashion to how pyunit
def assertIn(needle, haystack):
if output not in haystack:
print 'Failure: %r not in %r!' % (needle, haystack)
But unlike pyunit, there's no convenient or conventional location for
More information about the testing-in-python