summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_doctest.py
Commit message (Collapse)AuthorAgeFilesLines
* #6227: Because of a wrong indentation, the test was not testing what it should.Amaury Forgeot d'Arc2009-06-141-0/+2
| | | | Ensure that the snippet in doctest_aliases actually contains aliases.
* Fix several issues relating to access to source code inside zipfiles. ↵Nick Coghlan2008-12-141-1/+4
| | | | Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details.
* Patch #2167 from calvin: Remove unused importsChristian Heimes2008-02-231-1/+1
|
* Doctest results return a named tuple for readabilityRaymond Hettinger2008-01-111-58/+58
|
* Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.Georg Brandl2008-01-051-1/+1
|
* Replaced import of the 'new' module with 'types' module and added a ↵Christian Heimes2007-11-271-7/+7
| | | | deprecation warning to the 'new' module.
* Fix a bug in the test for using __loader__.get_data().Brett Cannon2007-11-231-0/+1
|
* Add a missing check before deleting a package's __loader__.Brett Cannon2007-11-211-1/+2
|
* doctest assumed that a package's __loader__.get_data() method used universalBrett Cannon2007-11-211-0/+17
| | | | | | | newlines; it doesn't. To rectify this the string returned replaces all instances of os.linesep with '\n' to fake universal newline support. Backport candidate.
* Remove a unneeded line that had typos.Brett Cannon2007-11-211-2/+0
|
* Bug #1529297: The rewrite of doctest for Python 2.4 unintentionallyTim Peters2006-07-271-7/+0
| | | | | lost that tests are sorted by name before being run. ``DocTestFinder`` has been changed to sort the list of tests it returns.
* Remove doctest.testmod's deprecated (in 2.4) `isprivate`Tim Peters2006-06-051-48/+9
| | | | argument. A lot of hair went into supporting that!
* Patch #1080727: add "encoding" parameter to doctest.DocFileSuiteGeorge Yoshida2006-05-281-6/+48
| | | | Contributed by Bjorn Tillenius.
* Variant of patch #1478292. doctest.register_optionflag(name)Tim Peters2006-05-101-0/+20
| | | | | shouldn't create a new flag when `name` is already the name of an option flag.
* Patch #1475231: add a new SKIP doctest option, thanks toTim Peters2006-04-251-0/+19
| | | | Edward Loper.
* Part of bug 1459808: fiddle so that this passesTim Peters2006-03-281-12/+12
| | | | with or without -Qnew.
* Merge ast-branch to headJeremy Hylton2005-10-201-6/+6
| | | | | | | | | | This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
* Fix test cases for doctest.Georg Brandl2005-06-261-0/+3
|
* add __file__ to the globals available for tests loaded via DocFileSuite;Fred Drake2004-12-211-0/+8
| | | | | this is useful for locating supporting data files, just as it is in Python modules
* test_doctest.py test_pdb_set_trace_nested(): A new test from Jim FultonTim Peters2004-11-081-3/+90
| | | | | | | | | 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.
* Reverted the addition of a NORMALIZE_NUMBERS option, per Tim Peter'sEdward Loper2004-09-281-101/+0
| | | | | | | | 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-0/+101
| | | | | the expected output to match corresponding number literals in the actual output if their values are equal (to ten digits of precision).
* - Changed SampleClass docstrings to test docstring parsing a littleEdward Loper2004-09-211-7/+18
| | | | more thouroughly.
* - Added "testfile" function, a simple function for running & verifyingEdward Loper2004-09-191-3/+132
| | | | | | | | 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/+26
| | | | | | | - 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/+20
| | | | | | | 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-4/+20
| | | | | 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-2/+2
| | | | | doctest always promised to stick "__test__" in the name. That got broken. Now it's fixed again.
* Recover from inspect.getmodule() changes. It returns a module forTim Peters2004-09-111-25/+42
| | | | | functions and methods now, including functions defined inside doctests in test_doctest.py's recursive doctest'ing.
* Added IGNORE_EXCEPTION_DETAIL comparison option. The need is explainedTim Peters2004-09-041-0/+37
| | | | | | | | 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.
* Whitespace normalization.Tim Peters2004-08-291-2/+2
|
* - setUp and tearDown functions are now passed the test objectJim Fulton2004-08-281-5/+111
| | | | | - Added a set_unittest_reportflags to set default reporting flags used when running doctests under unittest control.
* Removed outdated commentEdward Loper2004-08-271-2/+0
|
* - Removed redundant call to expandtabs in DocTestParesr.Edward Loper2004-08-271-51/+114
| | | | | | | | | | | | | | - 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-2/+57
| | | | | | | | | 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-7/+3
| | | | | | | | 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.
* Added REPORT_ONLY_FIRST_FAILURE flag, which supresses output after theEdward Loper2004-08-261-0/+81
| | | | first failing example in each test.
* Renamed UNIFIED_DIFF->REPORT_UDIFF; CONTEXT_DIFF->REPORT_CDIFF; andEdward Loper2004-08-261-7/+7
| | | | | | | 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/+2
|
* - Changed the output of report_start() and report_unexpected_exception()Edward Loper2004-08-261-22/+40
| | | | | | | 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-16/+77
| | | | | | | | | 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-3/+13
| | | | | | | | 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.
* test_DocTestFinder(): This test failed when test_doctest was runTim Peters2004-08-231-2/+5
| | | | | directly, due to assuming a filename specific to running tests "the normal way". +ELLIPSIS to the rescue!
* Moved some test cases from doctest to test_doctest.Tim Peters2004-08-231-2/+126
|
* Added NDIFF_DIFF option.Tim Peters2004-08-221-3/+29
|
* Bugs fixed:Jim Fulton2004-08-221-56/+115
| | | | | | | | | | | | | | | - Test filenames sometimes had trailing .pyc or .pyo sufixes (when module __file__ did). - Trailing spaces spaces in expected output were dropped. New default failure format: - Separation of examples from file info makes examples easier to see - More vertical separation, improving readability - Emacs-recognized file info (also closer to Python exception format)
* _ellipsis_match(): Removed special-casing of "...\n". The semanticsTim Peters2004-08-221-28/+5
| | | | | | are non-obvious either way because the newline character "is invisible", but it's still there all the same, and it's easier to explain/predict if that reality is left alone.
* Now that they've settled down, document doctest directives.Tim Peters2004-08-191-3/+17
|
* Replaced the ELLIPSIS implementation with a worst-case linear-time one.Tim Peters2004-08-191-8/+20
|
* ELLIPSIS implementation: an ellipsis couldn't match nothing if itTim Peters2004-08-191-0/+23
| | | | | | | appeared at the end of a line. Repaired that. Also noted that it's too easy to provoke this implementation into requiring exponential time, and especially when a test fails. I'll replace the implementation with an always-efficient one later.