>>> def no_examples(v):
... ''' no doctest examples '''
- >>> finder.find(no_examples)
- [<DocTest no_examples from None:1 (no examples)>]
+ >>> finder.find(no_examples) # doctest: +ELLIPSIS
+ [<DocTest no_examples from ...:1 (no examples)>]
Finding Tests in Classes
~~~~~~~~~~~~~~~~~~~~~~~~
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=True).run(test)
+ ... # doctest: +ELLIPSIS
Trying:
x = 12
Expecting nothing
Expecting:
14
**********************************************************************
- Line 3, in f
+ File ..., line 4, in f
Failed example:
print x
Expected:
>>> doctest.DocTestRunner(verbose=False).run(test)
... # doctest: +ELLIPSIS
**********************************************************************
- Line 3, in f
+ File ..., line 4, in f
Failed example:
print 'pre-exception output', x/0
Exception raised:
>>> doctest.DocTestRunner(verbose=False).run(test)
... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 3, in f
Failed example:
raise ValueError, 'message'
Expected:
>>> doctest.DocTestRunner(verbose=False).run(test)
... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 3, in f
Failed example:
raise ValueError, 'message' #doctest: +IGNORE_EXCEPTION_DETAIL
Expected:
>>> doctest.DocTestRunner(verbose=False).run(test)
... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 3, in f
Failed example:
1/0
Exception raised:
>>> test = doctest.DocTestFinder().find(f)[0]
>>> flags = doctest.DONT_ACCEPT_TRUE_FOR_1
>>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 1, in f
+ File ..., line 2, in f
Failed example:
True
Expected:
>>> test = doctest.DocTestFinder().find(f)[0]
>>> flags = doctest.DONT_ACCEPT_BLANKLINE
>>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 1, in f
+ File ..., line 2, in f
Failed example:
print "a\n\nb"
Expected:
>>> # Without the flag:
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 1, in f
+ File ..., line 2, in f
Failed example:
print 1, 2, 3
Expected:
>>> # Without the flag:
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 1, in f
+ File ..., line 2, in f
Failed example:
print range(15)
Expected:
>>> # Without the flag:
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 3, in f
Failed example:
print '\n'.join('abcdefg')
Expected:
>>> test = doctest.DocTestFinder().find(f)[0]
>>> flags = doctest.REPORT_UDIFF
>>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 3, in f
Failed example:
print '\n'.join('abcdefg')
Differences (unified diff with -expected +actual):
>>> test = doctest.DocTestFinder().find(f)[0]
>>> flags = doctest.REPORT_CDIFF
>>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 3, in f
Failed example:
print '\n'.join('abcdefg')
Differences (context diff with expected followed by actual):
>>> test = doctest.DocTestFinder().find(f)[0]
>>> flags = doctest.REPORT_NDIFF
>>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 3, in f
Failed example:
print "a b c d e f g h i j k l m"
Differences (ndiff with -expected +actual):
>>> test = doctest.DocTestFinder().find(f)[0]
>>> flags = doctest.REPORT_ONLY_FIRST_FAILURE
>>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 4, in f
+ File ..., line 5, in f
Failed example:
print 2 # first failure
Expected:
However, output from `report_start` is not supressed:
>>> doctest.DocTestRunner(verbose=True, optionflags=flags).run(test)
+ ... # doctest: +ELLIPSIS
Trying:
print 1 # first success
Expecting:
Expecting:
200
**********************************************************************
- Line 4, in f
+ File ..., line 5, in f
Failed example:
print 2 # first failure
Expected:
>>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
... # doctest: +ELLIPSIS
**********************************************************************
- Line 4, in f
+ File ..., line 5, in f
Failed example:
raise ValueError(2) # first failure
Exception raised:
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 2, in f
Failed example:
print range(10) # should fail: no ellipsis
Expected:
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False,
... optionflags=doctest.ELLIPSIS).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 6, in f
+ File ..., line 6, in f
Failed example:
print range(10) # doctest: -ELLIPSIS
Expected:
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 2, in f
Failed example:
print range(10) # Should fail: no ellipsis
Expected:
Got:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
**********************************************************************
- Line 8, in f
+ File ..., line 8, in f
Failed example:
print range(10) # Should fail: no ellipsis
Expected:
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 2, in f
Failed example:
print range(10) # Should fail
Expected:
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 2, in f
Failed example:
print range(10) # Should fail
Expected:
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
- Line 2, in f
+ File ..., line 2, in f
Failed example:
print range(10) # Should fail
Expected: