| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
|
| |
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-99520)
Also updates calls in collections, doctest, enum, and typing modules to use _getframemodulename first when available.
|
| |
|
|
|
|
|
| |
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
|
|
|
|
| |
Co-authored-by: Piet Delport
Co-authored-by: Hugo Lopes Tavares
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
|
|
| |
Assume co_firstlineno always exists on types.CodeType objects.
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
(GH-24359)
Followup to bpo-1812 and GH-17385.
|
|
|
|
| |
`__loader__` is missing (#22929)
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
* 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.
|
|
|
|
| |
Classes that define __str__ the same as __repr__ can
just inherit it from object.
|
| |
|
|
|
|
|
|
| |
(#4471)
Also fixed searching patterns that could match an empty string.
|
| |
|
|
|
|
|
|
|
| |
And most of the tools.
Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
|
|
|
|
|
| |
Issue #26641: doctest.DocFileTest and doctest.testfile() now support packages
(module splitted into multiple directories) for the package parameter.
|
|
|
|
|
| |
Write the module name rather than <module> in the error message, if module has
no __file__ attribute (ex: package).
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| |/
| |
| | |
returned NotImplemented. Removed incorrect implementations of __ne__().
|
| |
| |
| |
| | |
returned NotImplemented. Removed incorrect implementations of __ne__().
|
| | |
|
| |
| |
| |
| | |
class name instead of hardcoded one.
|
|/
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
doesn't have __objclass__.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|\
| |
| |
| |
| | |
determined minimal width of repeated subexpression is >0 (an empty line was
not matched in any case).
|
| |
| |
| |
| |
| | |
determined minimal width of repeated subexpression is >0 (an empty line was
not matched in any case).
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| |
| |
| | |
This provides a way to specify arbitrary doctest options when using
the CLI interface to process test files, just as one can when calling
testmod or testfile programmatically.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
attributes to None.
The long-term goal is for people to be able to rely on these
attributes existing and checking for None to see if they have been
set. Since import itself sets these attributes when a loader does not
the only instances when the attributes are None are from someone
overloading __import__() and not using a loader or someone creating a
module from scratch.
This patch also unifies module initialization. Before you could have
different attributes with default values depending on how the module
object was created. Now the only way to not get the same default set
of attributes is to circumvent initialization by calling
ModuleType.__new__() directly.
|
|/
|
|
| |
Patch by me, most of the work (doc and tests) by Daniel Urban.
|
|\
| |
| |
| |
| |
| |
| | |
Also adds tests to verify the documented behavior (which is probably a bug, as
indicated in the added comments).
Patch by Chris Jerdonek.
|
| |
| |
| |
| |
| |
| |
| | |
Also adds tests to verify the documented behavior (which is probably a bug, as
indicated in the added comments).
Patch by Chris Jerdonek.
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/
| |
| | |
Patch by Cédric Krier.
|
| |
| |
| |
| | |
Patch by Cédric Krier.
|
| | |
|
|\ \
| |/
| |
| |
| |
| |
| | |
file anymore to avoid encoding issues (it used the locale encoding, whereas
UTF-8 should be).
Remove also an unused import (warnings).
|