summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-120254: Add a `commands` argument to `pdb.set_trace` (#120255)Tian Gao2024-09-241-2/+2
|
* Remove almost all unpaired backticks in docstrings (#119231)Geoffrey Thomas2024-05-221-2/+2
| | | | | | | | | | | | | | | | | | As reported in #117847 and #115366, an unpaired backtick in a docstring tends to confuse e.g. Sphinx running on subclasses of standard library objects, and the typographic style of using a backtick as an opening quote is no longer in favor. Convert almost all uses of the form The variable `foo' should do xyz to The variable 'foo' should do xyz and also fix up miscellaneous other unpaired backticks (extraneous / missing characters). No functional change is intended here other than in human-readable docstrings.
* gh-117225: Move colorize functionality to own internal module (#118283)Hugo van Kemenade2024-05-011-22/+16
|
* gh-112730: Make the test suite resilient to color-activation environment ↵Pablo Galindo Salgado2024-04-241-1/+9
| | | | variables (#117672)
* gh-117225: Add color to doctest output (#117583)Hugo van Kemenade2024-04-241-11/+38
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-117692: Fix `AttributeError` in `DocTestFinder` on wrapped ↵Nikita Sobolev2024-04-101-1/+8
| | | | | | `builtin_or_method` (#117699) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-117294: Report DocTestCase as skipped if all examples in the doctest are ↵Malcolm Smith2024-03-281-3/+4
| | | | skipped (GH-117297)
* gh-117225: doctest: only print "and X failed" when non-zero, don't pluralise ↵Hugo van Kemenade2024-03-271-20/+39
| | | | "1 items" (#117228)
* gh-115341: Fix loading unit tests with doctests in -OO mode (GH-115342)Serhiy Storchaka2024-02-191-1/+1
|
* gh-115392: Fix doctest reporting incorrect line numbers for decorated ↵Brian Schubert2024-02-141-1/+1
| | | | functions (#115440)
* gh-61648: Detect line numbers of properties in doctests (GH-113161)Serhiy Storchaka2023-12-151-0/+2
|
* gh-94722: fix DocTest.__eq__ for case of no line number on one side (#112385)Irit Katriel2023-11-251-2/+4
|
* gh-111159: Fix `SyntaxError` doctests for non-builtin exception classes ↵Nikita Sobolev2023-11-041-1/+5
| | | | (#111541)
* gh-111159: Fix `doctest` output comparison for exceptions with notes (#111160)Nikita Sobolev2023-10-211-1/+14
|
* gh-108794: doctest counts skipped tests (#108795)Victor Stinner2023-09-021-64/+86
| | | | | | | | | | | | * Add 'skipped' attribute to TestResults. * Add 'skips' attribute to DocTestRunner. * Rename private DocTestRunner._name2ft attribute to DocTestRunner._stats. * Use f-string for string formatting. * Add some tests. * Document DocTestRunner attributes and its API for statistics. * Document TestResults class. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-107715: Escape class name in regular expression (GH-107716)Gertjan van Zwieten2023-08-071-1/+1
| | | | | | | | | This patch escapes the class name before embedding it in the regular expression for `pat` in `doctest.DocTestFinder._find_lineno`. While class names do not ordinarily contain special characters, it is possible to encounter these when a class is created dynamically. Escaping the name will correctly return `None` in this scenario, rather than potentially matching a different class or raising `re.error` depending on the symbols used.
* gh-86682: Adds sys._getframemodulename as an alternative to using _getframe ↵Steve Dower2023-01-131-1/+7
| | | | | (GH-99520) Also updates calls in collections, doctest, enum, and typing modules to use _getframemodulename first when available.
* gh-99433: Fix `doctest` failure on `types.MethodWrapperType` (#99434)Nikita Sobolev2022-12-301-1/+2
|
* bpo-28249: fix `lineno` location for empty `DocTest` instances (GH-30498)Nikita Sobolev2022-05-191-5/+9
| | | | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-2604: Make doctest.DocTestCase reset globs in teardown (GH-31932)Daniël van Noord2022-03-221-0/+3
| | | | | Co-authored-by: Piet Delport Co-authored-by: Hugo Lopes Tavares Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-46306: simplify `CodeType` attribute access in `doctest.py` (GH-30481)Nikita Sobolev2022-01-081-1/+1
| | | | | Assume co_firstlineno always exists on types.CodeType objects. Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-44904: Fix classmethod property bug in doctest module (GH-28838)Alex Waygood2021-10-281-4/+2
| | | | | | | | The doctest module raised an error if a docstring contained an example that attempted to access a classmethod property. (Stacking '@classmethod' on top of `@property` has been supported since Python 3.9; see https://docs.python.org/3/howto/descriptor.html#class-methods.) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35753: Fix crash in doctest with unwrap-able functions (#22981)Alfred Perlstein2021-05-051-2/+13
| | | | | | | | | Ignore objects that inspect.unwrap throws due to too many wrappers. This is a very rare case, however it can easily be surfaced when a module under doctest imports unitest.mock.call into its namespace. We simply skip any object that throws this exception. This should handle the majority of cases.
* bpo-43049: Use io.IncrementalNewlineDecoder for doctest newline conversion ↵Peter Donis2021-03-021-6/+3
| | | | | (GH-24359) Followup to bpo-1812 and GH-17385.
* bpo-42133: update parts of the stdlib to fall back to `__spec__.loader` when ↵Brett Cannon2020-11-071-7/+11
| | | | `__loader__` is missing (#22929)
* bpo-1812: Fix newline conversion when doctest.testfile loads from a package ↵Peter Donis2020-03-261-1/+8
| | | | | whose loader has a get_data method (GH-17385) This pull request fixes the newline conversion bug originally reported in bpo-1812. When that issue was originally submitted, the open builtin did not default to universal newline mode; now it does, which makes the issue fix simpler, since the only code path that needs to be changed is the one in doctest._load_testfile where the file is loaded from a package whose loader has a get_data method.
* bpo-36406: Handle namespace packages in doctest (GH-12520)Xtreak2019-12-131-1/+2
|
* bpo-15999: Clean up of handling boolean arguments. (GH-15610)Serhiy Storchaka2019-09-011-1/+1
| | | | | | * Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
* bpo-36793: Remove unneeded __str__ definitions. (GH-13081)Serhiy Storchaka2019-05-061-2/+1
| | | | Classes that define __str__ the same as __repr__ can just inherit it from object.
* bpo-24746: Avoid stripping trailing whitespace in doctest fancy diff (#10639)Sanyam Khurana2019-01-091-2/+0
|
* bpo-25054, bpo-1647489: Added support of splitting on zerowidth patterns. ↵Serhiy Storchaka2017-12-041-1/+1
| | | | | | (#4471) Also fixed searching patterns that could match an empty string.
* bpo-30166: Import command-line parsing modules only when needed. (#1293)Serhiy Storchaka2017-05-041-1/+2
|
* #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-4/+4
| | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* doctest now supports packagesVictor Stinner2016-03-291-4/+13
| | | | | Issue #26641: doctest.DocFileTest and doctest.testfile() now support packages (module splitted into multiple directories) for the package parameter.
* doctest: fix _module_relative_path() error messageVictor Stinner2016-03-251-2/+3
| | | | | Write the module name rather than <module> in the error message, if module has no __file__ attribute (ex: package).
* Merge typo and grammar fixes from 3.4 into 3.5Martin Panter2015-11-141-1/+1
|\
| * Fix a few grammar problems in the documentation and commentsMartin Panter2015-11-141-1/+1
| |
* | Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-2/+2
| | | | | | | | | | | | The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.
* | Issue #21408: The default __ne__() now returns NotImplemented if __eq__()Serhiy Storchaka2015-01-261-9/+0
|\ \ | |/ | | | | returned NotImplemented. Removed incorrect implementations of __ne__().
| * Issue #21408: The default __ne__() now returns NotImplemented if __eq__()Serhiy Storchaka2015-01-261-9/+0
| | | | | | | | returned NotImplemented. Removed incorrect implementations of __ne__().
* | Issue #21740: Support wrapped callables in pydoc. Patch by Claudiu Popa.Yury Selivanov2014-12-081-1/+2
| |
* | Issue #22033: Reprs of most Python implemened classes now contain actualSerhiy Storchaka2014-07-251-2/+3
| | | | | | | | class name instead of hardcoded one.
* | #15916: if there are no docstrings, make empty suite, not an error.R David Murray2014-04-151-9/+0
|/ | | | | | | | | | This makes doctest work like unittest: if the test case is empty, that just means there are zero tests run, it's not an error. The existing behavior was broken, since it only gave an error if there were *no* docstrings, and zero tests run if there were docstrings but none of them contained tests. So this makes it self-consistent as well. Patch by Glenn Jones.
* Issue #3158: Provide a couple of fallbacks for in case a method_descriptorZachary Ware2014-02-061-1/+7
| | | | doesn't have __objclass__.
* Issue #19138: doctest's IGNORE_EXCEPTION_DETAIL now allows no detail at all.Tim Peters2013-12-041-4/+29
|
* Issue #3158: doctest can now find doctests in functions and methodsZachary Ware2013-11-241-5/+6
| | | | | | | | written in C. As a part of this, a few doctests have been added to the builtins module (on hex(), oct(), and bin()), a doctest has been fixed (hopefully on all platforms) on float, and test_builtins now runs doctests in builtins.
* Fix tests for #11798Andrew Svetlov2013-08-281-3/+9
|
* Issue #18647: A regular expression in the doctest module rewritten so thatSerhiy Storchaka2013-08-191-1/+1
|\ | | | | | | | | determined minimal width of repeated subexpression is >0 (an empty line was not matched in any case).
| * Issue #18647: A regular expression in the doctest module rewritten so thatSerhiy Storchaka2013-08-191-1/+1
| | | | | | | | | | determined minimal width of repeated subexpression is >0 (an empty line was not matched in any case).
* | #18705: merge with 3.3.Ezio Melotti2013-08-171-2/+2
|\ \ | |/