#17404: long time doctests in multi-line code not detected
-------------------------+-------------------------------------------------
Reporter: dkrenn | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.5
Component: doctest | Keywords: doctest, multiline code, long
framework | time
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
-------------------------+-------------------------------------------------
When having a file {{{long-doctest-bug.py}}} with a function
{{{
def f(t):
"""
TESTS::
sage: f(2)
sage: f(3) # long time
sage: [f(4),
....: ] # long time
sage: [f(5), # long time
....: ]
"""
print "sleep", t
sleep(t)
}}}
and doctesting it with {{{sage -t long-doctest-bug.py}}}, the line
containing {{{f(4)}}} is tested as well:
{{{
Running doctests with ID 2014-11-26-16-34-55-f22cca2c.
Doctesting 1 file.
sage -t long-doctest-bug.py
**********************************************************************
File "long-doctest-bug.py", line 5, in long-doctest-bug.f
Failed example:
f(2)
Expected nothing
Got:
sleep 2
**********************************************************************
File "long-doctest-bug.py", line 7, in long-doctest-bug.f
Failed example:
[f(4),
] # long time
Expected nothing
Got:
sleep 4
[None]
**********************************************************************
1 item had failures:
2 of 3 in long-doctest-bug.f
[2 tests, 2 failures, 6.01 s]
----------------------------------------------------------------------
sage -t long-doctest-bug.py # 2 doctests failed
----------------------------------------------------------------------
Total time for all tests: 6.0 seconds
cpu time: 0.0 seconds
cumulative wall time: 6.0 seconds
}}}
Anyhow, note that it works when {{{# long time}}} is put at the end of the
first line, which can look weird.
--
Ticket URL: <http://trac.sagemath.org/ticket/17404>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.