summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix test cases for doctest.Georg Brandl2005-06-261-0/+1
|
* bug [ 1172785 ] doctest.script_from_examples() result sometimes un-exec-ableGeorg Brandl2005-06-261-1/+2
|
* SF patch 1167316: doctest.py fails self-test if run directly.Tim Peters2005-03-281-5/+5
| | | | | | Patch by Ilya Sandler. Bugfix candidate.
* add __file__ to the globals available for tests loaded via DocFileSuite;Fred Drake2004-12-211-0/+4
| | | | | this is useful for locating supporting data files, just as it is in Python modules
* And delete a useless comment.Tim Peters2004-11-081-1/+0
|
* _OutputRedirectingPdb.trace_dispatch(): Return the base class'sTim Peters2004-11-081-4/+5
| | | | trace_dispatch() result in a more obvious, and more robust way.
* test_doctest.py test_pdb_set_trace_nested(): A new test from Jim FultonTim Peters2004-11-081-3/+2
| | | | | | | | | showing that doctest's pdb.set_trace() support was dramatically broken. doctest.py _OutputRedirectingPdb.trace_dispatch(): Return a local trace function instead of (implicitly) None. Else interaction with pdb was bizarre, noticing only 'call' events. Amazingly, the existing set_trace() tests didn't care.
* Fixed a small bug. doctest didn't handle unicode docstrings containingJim Fulton2004-10-131-1/+3
| | | | non-ascii characters.
* Reverted the addition of a NORMALIZE_NUMBERS option, per Tim Peter'sEdward Loper2004-09-281-79/+1
| | | | | | | | request. Tim says that "correct 'fuzzy' comparison of floats cannot be automated." (The motivation behind adding the new option was verifying interactive examples in Python's latex documentation; several such examples use numbers that don't print consistently on different platforms.)
* Added a new NORMALIZE_NUMBERS option, which causes number literals inEdward Loper2004-09-281-1/+79
| | | | | the expected output to match corresponding number literals in the actual output if their values are equal (to ten digits of precision).
* - Added a "parser" option to testfile() and DocFileTest().Edward Loper2004-09-271-5/+12
|
* Removed debug_script from the public API: no docs, not public. I'm inTim Peters2004-09-261-1/+0
| | | | | the process of writing docs for the other "missing" debug support functions.
* Add set_unittest_reportflags() to the public API. Docs will followTim Peters2004-09-261-0/+1
| | | | "soon", after I repair the LaTeX I somehow damaged.
* Removed two undocumented unittest support classes, and one undocumentedTim Peters2004-09-261-3/+0
| | | | | unittest support function, from the public interface. If they're not documented, they shouldn't be public.
* Removed most of the module docstring. There's too much to explain now,Tim Peters2004-09-251-124/+2
| | | | and the LaTeX docs are in increasingly good shape.
* - Minor docstring fixes.Edward Loper2004-09-211-15/+9
| | | | - Simplified code to find names for file-based tests.
* Whitespace normalization.Tim Peters2004-09-201-4/+4
|
* - Added "testfile" function, a simple function for running & verifyingEdward Loper2004-09-191-37/+183
| | | | | | | | all examples in a given text file. (analagous to "testmod") - Minor docstring fixes. - Added module_relative parameter to DocTestFile/DocTestSuite, which controls whether paths are module-relative & os-independent, or os-specific.
* In DocFileTest:Edward Loper2004-09-181-3/+20
| | | | | | | - Fixed bug in handling of absolute paths. - If run from an interactive session, make paths relative to the directory containing sys.argv[0] (since __main__ doesn't have a __file__ attribute).
* exclude_empty: make the default True for DocTestFinder, and introduce itTim Peters2004-09-131-7/+7
| | | | | | | with default False for testmod(). The real point of introducing this was so that output from doctest.master.summarize() would be the same as in 2.3, and doctest.master in 2.4 is a backward-compatability hack used only by testmod().
* Added new parameter exclude_empty to DocTestFinder.__init__, whichEdward Loper2004-09-131-8/+14
| | | | | controls whether tests are included for objects with empty docstrings. Defaults to True, to match the behavior of Python 2.3.
* DocTestFinder._find(): for tests derived from a module __test__ global,Tim Peters2004-09-131-1/+1
| | | | | doctest always promised to stick "__test__" in the name. That got broken. Now it's fixed again.
* Reluctantly, rehabilitate doctest.master.Tim Peters2004-09-131-9/+26
|
* Tester.run___test__(): This couldn't possibly work at all. I'm afraidTim Peters2004-09-121-1/+1
| | | | the "backward compatibility" here was a joke.
* Tester.__init__(): this couldn't possibly work when a module argumentTim Peters2004-09-121-1/+1
| | | | was passed.
* Added IGNORE_EXCEPTION_DETAIL comparison option. The need is explainedTim Peters2004-09-041-32/+47
| | | | | | | | in the new docs. DocTestRunner.__run: Separate the determination of the example outcome from reporting that outcome, to squash brittle code duplication and excessive nesting.
* Added a couple names to __all__.Tim Peters2004-09-041-0/+2
|
* The distinction between comparison flags and reporting flags isn't uniqueTim Peters2004-08-301-28/+19
| | | | | | | | | | | to unittest, so make it official: new module constants COMPARISON_FLAGS and REPORTING_FLAGS, which are bitmasks or'ing together the relevant individual option flags. set_unittest_reportflags(): Reworked to use REPORTING_FLAGS, and simplified overly complicated flag logic. class FakeModule: Removed this; neither documented nor used.
* Whitespace normalization.Tim Peters2004-08-291-8/+8
|
* - setUp and tearDown functions are now passed the test objectJim Fulton2004-08-281-17/+124
| | | | | - Added a set_unittest_reportflags to set default reporting flags used when running doctests under unittest control.
* Remove unused method _OutputRedirectingPdb.resumeEdward Loper2004-08-271-3/+0
|
* - Removed redundant call to expandtabs in DocTestParesr.Edward Loper2004-08-271-16/+61
| | | | | | | | | | | | | | - Improvements to interactive debugging support: - Changed the replacement pdb.set_trace to redirect stdout to the real stdout *only* during interactive debugging; stdout from code continues to go to the fake stdout. - When the interactive debugger gets to the end of an example, automatically continue. - Use a replacement linecache.getlines that will return source lines from doctest examples; this makes the source available to the debugger for interactive debugging. - In test_doctest, use a specialized _FakeOutput class instead of a temporary file to fake stdin for the interactive interpreter.
* - Added DocTestParser.parse(), which parses a docstring into ExamplesEdward Loper2004-08-261-143/+80
| | | | | | | | | and intervening text strings. - Removed DocTestParser.get_program(): use script_from_examples() instead. - Fixed bug in DocTestParser._INDENT_RE - Fixed bug in DocTestParser._min_indent - Moved _want_comment() to the utility function section
* output_difference(): In fancy-diff cases, the way this split expected &Tim Peters2004-08-261-2/+2
| | | | | | | | actual output into lines created spurious empty lines at the ends of each. Those matched, but the fancy diffs had surprising line counts (1 larger than expected), and tests kept having to slam <BLANKLINE> into the expected output to account for this. Using the splitlines() string method with keepends=True instead accomplishes what was intended directly.
* _do_a_fancy_diff(): Pay no attention to the ellipses behind the curtain.Tim Peters2004-08-261-7/+11
| | | | | | | | | While a fancy diff can be confusing in the presence of ellipses, so far I'm finding (2-0-0) that it's much more a major aid in narrowing down the possibilities when an ellipsis-slinging test fails. So we no longer refuse to do a fancy diff just because of ellipses. This isn't ideal; it's just better.
* Changed OutputChecker.output_difference to expect an Example object,Edward Loper2004-08-261-6/+6
| | | | | | rather than an expected output string. This gives the output_difference method access to more information, such as the indentation of the example, which might be useful.
* Added REPORT_ONLY_FIRST_FAILURE flag, which supresses output after theEdward Loper2004-08-261-10/+22
| | | | first failing example in each test.
* Renamed UNIFIED_DIFF->REPORT_UDIFF; CONTEXT_DIFF->REPORT_CDIFF; andEdward Loper2004-08-261-16/+16
| | | | | | | NDIFF_DIFF->REPORT_NDIFF. This establishes the naming convention that all reporting options should begin with "REPORT_" (since reporting options are a different class from output comparison options; but they are both set in optionflags).
* Shortened diff output for unified & context diffsEdward Loper2004-08-261-6/+6
|
* - Changed the output of report_start() and report_unexpected_exception()Edward Loper2004-08-261-36/+24
| | | | | | | to be more consistent with report_failure() - If `want` or `got` is empty, then print "Expected nothing\n" or "Got nothing\n" rather than "Expected:\n" or "Got:\n" - Got rid of _tag_msg
* Added an "exc_msg" attribute to Example (containing the expectedEdward Loper2004-08-261-43/+62
| | | | | | | | | exception message, or None if no exception is expected); and moved exception parsing from DocTestRunner to DocTestParser. This is architecturally cleaner, since it moves all parsing work to DocTestParser; and it should make it easier for code outside DocTestRunner (notably debugging code) to properly handle expected exceptions.
* Only recognize the expected output as an exception if it *starts* withEdward Loper2004-08-251-12/+8
| | | | | | | | a traceback message. I.e., examples that raise exceptions may no longer generate pre-exception output. This restores the behavior of doctest in python 2.3. The ability to check pre-exception output is being removed because it makes the documentation simpler; and because there are very few use cases for it.
* The attempt to shut up deprecation warnings for doctest's own use ofTim Peters2004-08-231-2/+5
| | | | | is_private in its tests failed if doctest.py was run directly. Now it works.
* Moved some test cases from doctest to test_doctest.Tim Peters2004-08-231-116/+0
|
* Misc cleanups.Tim Peters2004-08-231-28/+26
|
* debug_script(): I changed this in haste before to take out the use ofTim Peters2004-08-231-15/+22
| | | | | | | NamedTemporaryFile (which can't work for this function's purposes on Windows). Leaving temp files behind wasn't a great idea either, though, so try to clean up. At least the test suite no longer leaves any of these guys behind now.
* Start deferring to the LaTeX docs for details. I'd like to move theTim Peters2004-08-221-29/+3
| | | | | | | | | docstrings toward being a lot shorter, and telling the whole truth in the manual instead. This change is an example: the manual has detailed explanations of the option names now, so it's Bad to repeat them in the docstring (two detailed descriptions are certain to get out of synch). Just listing the names has memory-jogging benefits, though, so that's still helpful in the docstring.
* Added NDIFF_DIFF option.Tim Peters2004-08-221-6/+28
|
* Type in docstring.Tim Peters2004-08-221-1/+1
|
* _parse_example(): Simplified new code to preserve trailing spaces beforeTim Peters2004-08-221-12/+8
| | | | final newline. Anything to get rid of "l" as a variable name <0.5 wink>.