summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_doctest.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.10] bpo-28249: fix `lineno` location for empty `DocTest` instances ↵Łukasz Langa2022-05-191-1/+22
| | | | | | | | | | (GH-30498) (#92981) (cherry picked from commit 8db2b3b6878aba9f12844526bce966b7eed81aee) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* bpo-2604: Make doctest.DocTestCase reset globs in teardown (GH-31932)Miss Islington (bot)2022-03-221-0/+16
| | | | | | | | Co-authored-by: Piet Delport Co-authored-by: Hugo Lopes Tavares Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 7ba7eae50803b11766421cb8aae1780058a57e2b) Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
* bpo-44904: Fix classmethod property bug in doctest module (GH-28838)Miss Islington (bot)2021-10-281-0/+15
| | | | | | | | | | | 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.htmlGH-class-methods.) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit b1302abcc8a4be5f39b4d60a1ce28032b77655b3) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* bpo-45229: Make doctest tests discoverable (GH-28986) (GH-29095)Miss Islington (bot)2021-10-201-14/+6
| | | | | (cherry picked from commit 8d6740f489fca67a44de165d29d9e0ad86285779) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35753: Fix crash in doctest with unwrap-able functions (GH-22981) (#25926)Miss Islington (bot)2021-05-051-1/+14
| | | | | | | | | | | | 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. (cherry picked from commit 565a31804c1139fe7886f38af3b3923653b0c1b3) Co-authored-by: Alfred Perlstein <alfred@fb.com>
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142)Inada Naoki2021-04-021-3/+3
| | | | | | | | | | | | | * test__xxsubinterpreters * test_builtin * test_doctest * test_exceptions * test_opcodes * test_support * test_argparse * test_baseexception * test_bdb * test_bool * test_asdl_parser
* bpo-31904: fix test_doctest.py failures for VxWorks (GH-23419)pxinwr2020-12-041-1/+2
| | | | Fix test_doctest.py failures for VxWorks by avoiding exact error message checks. (better for everyone all around)
* bpo-40275: Use new test.support helper submodules in tests (GH-21448)Hai Shi2020-08-031-6/+10
|
* bpo-29882: Add an efficient popcount method for integers (#771)Niklas Fiekas2020-05-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | * bpo-29882: Add an efficient popcount method for integers * Update 'sign bit' and versionadded in docs * Add entry to whatsnew document * Doc: use positive example, mention population count * Minor cleanups of the core code * Move popcount_digit closer to where it's used * Use z instead of self after conversion * Add 'absolute value' and 'population count' to docstring * Fix clinic error about missing summary line * Ensure popcount_digit is portable with 64-bit ints Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-40636: Clarify the zip built-in docstring. (GH-20118)Gregory P. Smith2020-05-151-1/+2
| | | | | | | | | | | | | | | | | | | | | Clarify the zip built-in docstring. This puts much simpler text up front along with an example. As it was, the zip built-in docstring was technically correct. But too technical for the reader who shouldn't _need_ to know about `__next__` and `StopIteration` as most people do not need to understand the internal implementation details of the iterator protocol in their daily life. This is a documentation only change, intended to be backported to 3.8; it is only tangentially related to PEP-618 which might offer new behavior options in the future. Wording based a bit more on enumerate per Brandt's suggestion. This gets rid of the legacy wording paragraph which seems too tied to implementation details of the iterator protocol which isn't relevant here. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* bpo-39939: Add str.removeprefix and str.removesuffix (GH-18939)sweeneyde2020-04-221-1/+1
| | | | | Added str.removeprefix and str.removesuffix methods and corresponding bytes, bytearray, and collections.UserString methods to remove affixes from a string if present. See PEP 616 for a full description.
* bpo-39481: Implementation for PEP 585 (#18239)Guido van Rossum2020-04-071-1/+1
| | | | | | | | | | | | This implements things like `list[int]`, which returns an object of type `types.GenericAlias`. This object mostly acts as a proxy for `list`, but has attributes `__origin__` and `__args__` that allow recovering the parts (with values `list` and `(int,)`. There is also an approximate notion of type variables; e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`. Type variables are objects of type `typing.TypeVar`.
* bpo-1812: Fix newline conversion when doctest.testfile loads from a package ↵Peter Donis2020-03-261-4/+89
| | | | | 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/+5
|
* Fix typos in comments, docs and test names (#15018)Min ho Kim2019-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Fix typos in comments, docs and test names * Update test_pyparse.py account for change in string length * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: Dealloccte -> Deallocate Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Update posixmodule checksum. * Reverse idlelib changes.
* bpo-22385: Support output separators in hex methods. (#13578)Gregory P. Smith2019-05-291-1/+4
| | | | | | | | | | | | | | | | | | * bpo-22385: Support output separators in hex methods. Also in binascii.hexlify aka b2a_hex. The underlying implementation behind all hex generation in CPython uses the same pystrhex.c implementation. This adds support to bytes, bytearray, and memoryview objects. The binascii module functions exist rather than being slated for deprecation because they return bytes rather than requiring an intermediate step through a str object. This change was inspired by MicroPython which supports sep in its binascii implementation (and does not yet support the .hex methods). https://bugs.python.org/issue22385
* bpo-24746: Fix doctest failures when running the testsuite with -R (#11501)Pablo Galindo2019-01-101-2/+1
|
* bpo-24746: Avoid stripping trailing whitespace in doctest fancy diff (#10639)Sanyam Khurana2019-01-091-1/+47
|
* bpo-12458: Fix line numbers for multiline expressions. (GH-8774)Serhiy Storchaka2018-09-171-1/+1
|
* bpo-33073: Adding as_integer_ratio to ints. (GH-8750)Lisa Roach2018-09-141-1/+2
|
* bpo-33053: -m now adds *starting* directory to sys.path (GH-6231)Nick Coghlan2018-03-251-5/+11
| | | | | | | | | | | | Historically, -m added the empty string as sys.path zero, meaning it resolved imports against the current working directory, the same way -c and the interactive prompt do. This changes the sys.path initialisation to add the *starting* working directory as sys.path[0] instead, such that changes to the working directory while the program is running will have no effect on imports when using the -m switch.
* bpo-32991: Restore expectation that inspect.getfile raises TypeError on ↵Jason R. Coombs2018-03-051-1/+18
| | | | | | | | | | namespace package (GH-5980) * bpo-32991: Add test capturing expectation. DocTestFinder.find should return an empty list for doctests in a namespace package. * bpo-32991: Restore expectation that inspect.getfile on a namespace package raises TypeError.
* bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)INADA Naoki2018-01-271-1/+1
|
* #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-1/+1
| | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* Backed out changeset af29d89083b3 (closes #25548) (closes #27498)Benjamin Peterson2016-07-141-1/+1
|
* Issue #18300: Merge from 3.5Berker Peksag2016-06-241-15/+9
|\
| * Issue #18300: Set TERM='' by default in assert_python_*Berker Peksag2016-06-241-15/+9
| |
* | Issue #25548: Showing memory address of class objects in replKushal Das2016-06-041-1/+1
| |
* | Issue #27076: Merge spelling from 3.5Martin Panter2016-05-261-1/+1
|\ \ | |/
| * Issue #27076: Doc, comment and tests spelling fixesMartin Panter2016-05-261-1/+1
| | | | | | | | Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
* | Issue #23277: Remove unused imports in tests.Serhiy Storchaka2016-04-241-3/+1
| |
* | test_doctest: remove unused importsVictor Stinner2016-03-251-2/+1
|/
* Issue #26304: Change "allows to <verb>" to "allows <verb>ing" or similarMartin Panter2016-02-101-1/+1
| | | | | The original form is incorrect grammar and feels awkward, even though the meaning is clear.
* Fix test_doctest in verbose modeVictor Stinner2015-12-021-2/+2
|
* Issue #9517: Move script_helper to the support package.Berker Peksag2015-05-061-4/+4
| | | | Patch by Christie Wilson.
* Implements issue #9951: Adds a hex() method to bytes, bytearray, & memoryview.Gregory P. Smith2015-04-251-1/+1
| | | | | | | Also updates a few internal implementations of the same thing to use the new built-in code. Contributed by Arnon Yaari.
* Issue #23943: Fix typos. Patch by Piotr Kasprzyk.Berker Peksag2015-04-141-2/+2
|\
| * Issue #23943: Fix typos. Patch by Piotr Kasprzyk.Berker Peksag2015-04-141-2/+2
| |
* | Open files in binary mode to avoid newlines transformation.Serhiy Storchaka2015-04-041-4/+4
|\ \ | |/
| * Open files in binary mode to avoid newlines transformation.Serhiy Storchaka2015-04-041-4/+4
| |
* | Issue #21740: Support wrapped callables in pydoc. Patch by Claudiu Popa.Yury Selivanov2014-12-081-1/+18
| |
* | Merge: #8473: Add tests that doctest uses universal newlines in testfile.R David Murray2014-10-031-0/+30
|\ \ | |/
| * #8473: Add tests that doctest uses universal newlines in testfile.R David Murray2014-10-031-0/+30
| | | | | | | | Python3 does not have the bug covered by the issue.
* | Issue8297: module attribute lookup failures now include module name in error ↵Ethan Furman2014-04-241-2/+2
| | | | | | | | message.
* | #15916: if there are no docstrings, make empty suite, not an error.R David Murray2014-04-151-15/+18
| | | | | | | | | | | | | | | | | | | | 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.
* | fix #21076: turn signal module constants into enumsGiampaolo Rodola'2014-04-041-1/+1
|/
* Issue #19138: doctest's IGNORE_EXCEPTION_DETAIL now allows no detail at all.Tim Peters2013-12-041-0/+27
|
* Issue #3158: Relax new doctests a bit.Zachary Ware2013-11-241-4/+9
| | | | | | | Apparently, the number of objects with docstrings in builtins varies with --with-pydebug (non-debug has one fewer). Also, skip the new tests entirely if built --without-doc-strings.
* Issue #3158: doctest can now find doctests in functions and methodsZachary Ware2013-11-241-0/+29
| | | | | | | | 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.
* #11390: fix test failures due to readline and windows lineneds.R David Murray2013-06-251-22/+30
|