#8708: allow doctest script to handle docstrings with triple single quotes
---------------------------------------------------------+------------------
Reporter: mvngu | Owner: tbd
Type: enhancement | Status:
needs_work
Priority: blocker | Milestone:
sage-4.7.2
Component: doctest | Keywords:
Work_issues: Rebase on #9739 (and perhaps also 10952). | Upstream: N/A
Reviewer: Burcin Erocal | Author:
John Palmieri
Merged: | Dependencies:
#9739
---------------------------------------------------------+------------------
Changes (by leif):
* status: needs_review => needs_work
Comment:
I now get the following doctest failures, certainly due to the triple
single quote patch / modification:
{{{
The following tests failed:
sage -t -long -force_lib devel/sagenb-
main/sagenb/notebook/worksheet.py # Exception from doctest framework
sage -t -long -force_lib
devel/sage/sage/interacts/library_cython.pyx # 1 doctests failed
sage -t -long -force_lib devel/sage/sage/misc/sageinspect.py #
Exception from doctest framework
}}}
With `-verbose`:
{{{
#!sh
$ ./sage -t -long -verbose devel/sagenb-main/sagenb/notebook/worksheet.py
sage -t -long -verbose "devel/sagenb-main/sagenb/notebook/worksheet.py"
Traceback (most recent call last):
File "/home/leif/.sage//tmp/worksheet_15100.py", line 3046, in <module>
runner=runner)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/sagedoctest.py",
line 54, in testmod_returning_runner
runner=runner)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 1819, in testmod_returning_runner
for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 839, in find
self._find(tests, obj, name, module, source_lines, globs, {})
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 893, in _find
globs, seen)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 881, in _find
test = self._get_test(obj, name, module, globs, source_lines)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 965, in _get_test
filename, lineno)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 594, in get_doctest
return DocTest(self.get_examples(string, name), globs,
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 608, in get_examples
return [x for x in self.parse(string, name)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 570, in parse
self._parse_example(m, name, lineno)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 640, in _parse_example
lineno + len(source_lines))
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 726, in _check_prefix
(lineno+i+1, name, line))
ValueError: line 11 of the docstring for __main__.example_109 has
inconsistent leading whitespace: ' "'
Exception raised by doctesting framework. Use -verbose for details.
}}}
{{{
#!sh
$ ./sage -t -long -verbose devel/sage/sage/misc/sageinspect.py
sage -t -long -verbose "devel/sage/sage/misc/sageinspect.py"
Traceback (most recent call last):
File "/home/leif/.sage//tmp/sageinspect_15131.py", line 1327, in
<module>
runner=runner)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/sagedoctest.py",
line 54, in testmod_returning_runner
runner=runner)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 1819, in testmod_returning_runner
for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 839, in find
self._find(tests, obj, name, module, source_lines, globs, {})
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 893, in _find
globs, seen)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 881, in _find
test = self._get_test(obj, name, module, globs, source_lines)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 965, in _get_test
filename, lineno)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 594, in get_doctest
return DocTest(self.get_examples(string, name), globs,
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 608, in get_examples
return [x for x in self.parse(string, name)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 570, in parse
self._parse_example(m, name, lineno)
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 640, in _parse_example
lineno + len(source_lines))
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/local/bin/ncadoctest.py",
line 726, in _check_prefix
(lineno+i+1, name, line))
ValueError: line 53 of the docstring for __main__.example_28 has
inconsistent leading whitespace: ' """'
Exception raised by doctesting framework. Use -verbose for details.
}}}
{{{
#!sh
$ ./sage -t -long -verbose
devel/sage/sage/interacts/library_cython.pyxsage -t -long -verbose
"devel/sage/sage/interacts/library_cython.pyx"
...
Trying:
from sage.interacts.library_cython import cellular###line 91:_sage_
>>> from sage.interacts.library_cython import cellular
Expecting nothing
ok
Trying:
rule = [Integer(1), Integer(0), Integer(1), Integer(0), Integer(0),
Integer(1), Integer(1), Integer(0)]###line 92:_sage_ >>> rule = [1, 0,
1, 0, 0, 1, 1, 0]
Expecting nothing
ok
Trying:
N = Integer(3)###line 93:_sage_ >>> N = 3
Expecting nothing
ok
Trying:
print cellular(rule, Integer(3))###line 94:_sage_ >>> print
cellular(rule, 3)
Expecting nothing
**********************************************************************
File
"/home/leif/Sage/sage-4.7.2.alpha3-prerelease3/devel/sage/sage/interacts/library_cython.pyx",
line ?, in __main__.example_3
Failed example:
print cellular(rule, Integer(3))###line 94:_sage_ >>> print
cellular(rule, 3)
Expected nothing
Got:
[[0 0 0 1 0 0 0]
[0 0 0 1 0 0 0]
[0 1 0 1 0 1 0]]
Trying:
sig_on_count()
Expecting:
0
ok
4 items had no tests:
__main__
__main__.change_warning_output
__main__.check_with_tolerance
__main__.warning_function
3 items passed all tests:
3 tests in __main__.example_0
9 tests in __main__.example_1
8 tests in __main__.example_2
**********************************************************************
1 items had failures:
1 of 7 in __main__.example_3
27 tests in 8 items.
26 passed and 1 failed.
***Test Failed*** 1 failures.
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8708#comment:13>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.