[issue3158] Doctest fails to find doctests in extension modules

Zachary Ware report at bugs.python.org
Wed Jul 17 06:33:33 CEST 2013


Zachary Ware added the comment:

In looking at test_decimal for issue16748, I discovered that not all of the doctests for _decimal are being tested.  So, I fixed it (or at least tried to :).

This patch does the following:

- Replace most inspect.isfunction checks in DocTestFinder with inspect.isroutine

- Add a check to DocTestFinder._from_module for method_descriptors

- Correct a doctest on float.fromhex (which is incorrect back to 2.7) due to the new float repr

- Add a couple doctests to the builtins module because previously there were no functions in builtins with docstrings for testing against.  I chose to add to bin(), hex(), and oct(); I believe those three can benefit from having the docstring show the format of the output string.  I'm not terribly attached to those, though, so if anyone has a better suggestion for testing, I'm all ears.

- Add tests using the builtins module (since it's a C module that's definitely going to be available).

- Add doctests to test_builtin (because the tests aren't actually run in test_doctest, just found). While at it, convert test_builtin to unittest.main().  I believe test_builtin should grow doctest running even if the doctests I added to bin, hex, and oct aren't kept; float and int have some doctests that should be kept up to date.

- Add notes to the docs.

----------
keywords: +patch
nosy: +zach.ware
type:  -> enhancement
versions: +Python 3.4 -Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file30945/issue3158.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3158>
_______________________________________


More information about the Python-bugs-list mailing list