Commit Graph

64 Commits

Author SHA1 Message Date
busywhitespace e477348f36
gh-99970 Adding missing `optionflags` parameter in the documentation of `doctest` (#99971) 2022-12-10 15:42:40 +05:30
Stanley 286e3c76a9
gh-99087: Add missing newline for prompts in docs (GH-98993)
Add newline for prompts so copying to REPL does not cause errors.
2022-12-08 19:31:19 -08:00
George Zhang 22860dbbc8
doc: Remove backslashes in doctest grammar docs (#29346) 2022-11-27 12:08:39 +05:30
Ned Batchelder 3440d197a5
Docs: remove redundant "adverb-adjective" hyphens from compound modifiers (GH-94551)
Discussion: https://discuss.python.org/t/slight-grammar-fix-throughout-adverbs-dont-need-hyphen/17021
2022-07-05 11:16:10 +02:00
CAM Gerlach 97b9c1096f
gh-92417: Update docs and examples of doctest.IGNORE_EXCEPTION_DETAIL for Py>=3 (GH-92502) 2022-05-19 16:59:07 +02:00
Davide Rizzo 7b024e3a3f
gh-80856: doc: reveal doctest directives (#92318)
* Doc: Reveal doctest directives.

* Fix whitespace.

Co-authored-by: Julien Palard <julien@palard.fr>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-05-08 18:14:55 +02:00
Alex Waygood 5639ea1ef9
gh-92417: `doctest` docs: remove references to Python <3.6 (GH-92420) 2022-05-08 16:17:23 +03:00
andrei kulakov f76889a887
Fix doctest doc examples for syntax errors (GH-28486)
* fix doctest doc examples for syntax errors

* updated examples to use TypeErrors

* fixed first sentence

* unneeded comma
2021-09-29 12:44:43 +01:00
Julien Palard 5c1f15b4b1
bpo-42843: Keep Sphinx 1.8 and Sphinx 2 compatibility (GH-24282) 2021-01-25 15:46:06 +01:00
Julien Palard c8a10d2fab
bpo-36675: Doc: Reveal doctest directives (GH-23620) 2020-12-15 17:23:03 +01:00
Serhiy Storchaka 138ccbb022
bpo-38738: Fix formatting of True and False. (GH-17083)
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
2019-11-12 16:57:03 +02:00
Julien Palard 2c910c1e73 bpo-36675: Remove obsolete code. (GH-16024)
Does no longer work since Sphinx moved the trim_doctest_flag option in
the configuration.
2019-09-12 12:23:53 +01:00
Serhiy Storchaka 913876d824
bpo-35054: Add yet more index entries for symbols. (GH-10121) 2018-10-28 13:41:26 +02:00
Serhiy Storchaka ddb961d2ab
bpo-35054: Add more index entries for symbols. (GH-10064) 2018-10-26 09:00:49 +03:00
Stéphane Wirtel 0522fd81dc bpo-34839: Add a 'before 3.6' in the section 'warnings' of doctest (GH-9736) 2018-10-20 10:43:32 +02:00
UltimateCoder 8856940cf2 bpo-28315: Improve code examples in docs (GH-1372)
Replace
   File "<stdin>", line 1, in ? 
with 
   File "<stdin>", line 1, in <module>
2017-05-03 09:46:45 -07:00
Mariatta Wijaya 81b8977349 Issue #29371: Clarify bitwise OR operation in doctest option flags. 2017-02-06 20:15:01 -08:00
Serhiy Storchaka ecf41da83e Issue #19795: Mark up None as literal text. 2016-10-19 16:29:26 +03:00
Martin Panter 1050d2d0c7 Issue #26462: Doc: reduce literal_block warnings, fix syntax highlighting.
Patch by Julien Palard.
2016-07-26 11:18:21 +02:00
Terry Jan Reedy fa089b9b0b Issue #22558: Add remaining doc links to source code for Python-coded modules.
Reformat header above separator line (added if missing) to a common format.
Patch by Yoni Lavi.
2016-06-11 15:02:54 -04:00
Ethan Furman 7b51a55ecd Issue24756: clarify usage of run_docstring_examples() 2015-09-17 22:21:36 -07:00
Ethan Furman 2a5f9da56c Issue24756: clarify usage of run_docstring_examples() 2015-09-17 22:20:41 -07:00
Georg Brandl 1f6afef2ea merge with 3.4 2014-10-06 16:57:02 +02:00
Georg Brandl 7fa4a8f15a Closes #12148: clarify "or's together option flags" in doctest docs. 2014-10-06 16:56:43 +02:00
R David Murray 1976d9bf6d #15916: if there are no docstrings, make empty suite, not an error.
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.
2014-04-14 20:28:36 -04:00
Georg Brandl df48b97855 Fix a few scoping issues with versionadded/versionchanged directives. 2014-03-24 09:06:18 +01:00
Zachary Ware a4b7a7548c Issue #3158: doctest can now find doctests in functions and methods
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.
2013-11-24 01:19:09 -06:00
R David Murray 5707d508e1 #11390: convert doctest CLI to argparse and add -o and -f options.
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.
2013-06-23 14:24:13 -04:00
R David Murray 60dd6e538f #16522: s/always 1/at most 1/.
Correction thanks to Joey Geralnik.
2012-11-22 06:22:41 -05:00
R David Murray 5a9d706123 #16522: Add FAIL_FAST flag to doctest.
Patch by me, most of the work (doc and tests) by Daniel Urban.
2012-11-21 15:09:21 -05:00
Chris Jerdonek 3fa8c59024 Issue #12947: Remove doctest directives from the doctest examples in the "Option Flag" section.
The doctest examples that illustrate the use of doctest option flags
independent of doctest directives should not display doctest directives.
2012-10-10 08:34:38 -07:00
Georg Brandl 23a87de96f Missed one instance of code-block:: text highlighting to revert. 2012-10-10 16:56:15 +02:00
Georg Brandl 83e51f48a8 Issue #12947: revert earlier workaround and use a monkey-patch to enable showing doctest directives only in the doctest docs. 2012-10-10 16:45:11 +02:00
Chris Jerdonek 3650ea2a9f Issue #12947: Divide doctest "Option Flags and Directives" section into two.
This changeset also applies the rendering workaround to the last remaining
example in the file that has a doctest directive that should be displayed.
2012-10-10 06:52:08 -07:00
Nick Coghlan 0b26ccfaa6 Issue #12947: Better workaround for the problem with doctest directives being stripped from code examples that are intended to illustrate those directives 2012-10-03 13:52:48 +05:30
Nick Coghlan 8f80e0a651 Issue #12947: Add a note to doctest until the example rendering is fixed 2012-10-03 12:21:44 +05:30
Ezio Melotti 694f2331c6 Fix a few quotes/backslashes. 2012-09-20 09:47:03 +03:00
R David Murray 5abd76a75d #14649: clarify DocTestSuite error when there are no docstrings.
Also adds tests to verify the documented behavior (which is probably a bug, as
indicated in the added comments).

Patch by Chris Jerdonek.
2012-09-10 10:15:58 -04:00
Senthil Kumaran a6bac95a3c issue10403 - Let's not use members anymore. Use 'attribute' where it denotes attribute and 'methods' where it denotes methods. Context should clarify usage. 2011-07-04 11:28:30 -07:00
R. David Murray 796343b198 #10698: fix typo in example. 2010-12-13 22:50:30 +00:00
Éric Araujo 713d3039dc Fix usage of :option: in the docs (#9312).
:option: is used to create a link to an option of python, not to mark
up any instance of any arbitrary command-line option.  These were
changed to ````.

For modules which do have a command-line interface, lists of options
have been properly marked up with the program/cmdoption directives
combo.  Options defined in such blocks can be linked to with :option:
later in the same file, they won’t link to an option of python.

Finally, the markup of command-line fragments in optparse.rst has
been cleaned to use ``x`` instead of ``"x"``, keeping that latter
form for actual Python strings.

Patch by Eli Bendersky and Éric Araujo.
2010-11-18 16:38:46 +00:00
Georg Brandl 67b21b7547 Consistency check for versionadded/changed directives. 2010-08-17 15:07:14 +00:00
Georg Brandl 7cb1319688 Terminology fix: exceptions are raised, except in generator.throw(). 2010-08-03 12:06:29 +00:00
Georg Brandl a851483527 #8564: update docs on integrating doctest/unittest with unittest(2) test discovery. 2010-07-10 12:20:38 +00:00
R. David Murray 17c371ca30 Remove versionadded accidentally introduced by r82008. 2010-06-16 12:56:31 +00:00
R. David Murray 9691e59d77 Merged revisions 81634 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81634 | r.david.murray | 2010-05-31 21:42:41 -0400 (Mon, 31 May 2010) | 2 lines

  #7583: clarify discussion of hard tab expansion in doctests.
........
2010-06-15 23:46:40 +00:00
Nick Coghlan 5e76e94fd4 Merged revisions 80578 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80578 | nick.coghlan | 2010-04-29 00:29:06 +1000 (Thu, 29 Apr 2010) | 1 line

  Issue 7490: make IGNORE_EXCEPTION_DETAIL also ignore details of the module containing the exception under test (original patch by Lennart Regebro)
........
2010-06-12 13:42:46 +00:00
Georg Brandl 8f80a5ba50 Need to use list(range()) to get a list. 2010-03-21 09:25:54 +00:00
Ezio Melotti 0639d5aeb6 Merged revisions 76904 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76904 | ezio.melotti | 2009-12-20 00:41:49 +0200 (Sun, 20 Dec 2009) | 1 line

  #7388: "python".capitalize() in the Doc
........
2009-12-19 23:26:38 +00:00
R. David Murray 7c5714f78c Update example in doctest chapter that uses math.floor to reflect the
fact that the result is an int in py3k.  Thanks to 'flox' for pointing out
the discrepancy.
2009-11-23 03:13:23 +00:00