From 9d1a0928f7cbd685a71b08cc7e8f7e4875b38068 Mon Sep 17 00:00:00 2001 From: Derrick Date: Mon, 6 May 2019 14:26:59 -0400 Subject: [PATCH 1/2] Fix doctest directives comments disappear bug 1. Change :: detective to : in order to fix the doc bugs ref:https://bugs.python.org/issue36675 --- Doc/library/doctest.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index e7c0033eb6bc45..f6805b50279012 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -721,7 +721,7 @@ above. An example's doctest directives modify doctest's behavior for that single example. Use ``+`` to enable the named behavior, or ``-`` to disable it. -For example, this test passes:: +For example, this test passes: >>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, @@ -730,19 +730,19 @@ For example, this test passes:: Without the directive it would fail, both because the actual output doesn't have two blanks before the single-digit list elements, and because the actual output is on a single line. This test also passes, and also requires a directive to do -so:: +so: >>> print(list(range(20))) # doctest: +ELLIPSIS [0, 1, ..., 18, 19] Multiple directives can be used on a single physical line, separated by -commas:: +commas: >>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE [0, 1, ..., 18, 19] If multiple directive comments are used for a single example, then they are -combined:: +combined: >>> print(list(range(20))) # doctest: +ELLIPSIS ... # doctest: +NORMALIZE_WHITESPACE @@ -750,7 +750,7 @@ combined:: As the previous example shows, you can add ``...`` lines to your example containing only directives. This can be useful when an example is too long for -a directive to comfortably fit on the same line:: +a directive to comfortably fit on the same line: >>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40))) ... # doctest: +ELLIPSIS From 1ba5448018562b78e51e6eca924d343330e290ab Mon Sep 17 00:00:00 2001 From: Derrick Date: Mon, 6 May 2019 15:11:33 -0400 Subject: [PATCH 2/2] Add blurb entry for this fix. --- .../next/Documentation/2019-05-06-15-11-23.bpo-36675.ddGwxG.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2019-05-06-15-11-23.bpo-36675.ddGwxG.rst diff --git a/Misc/NEWS.d/next/Documentation/2019-05-06-15-11-23.bpo-36675.ddGwxG.rst b/Misc/NEWS.d/next/Documentation/2019-05-06-15-11-23.bpo-36675.ddGwxG.rst new file mode 100644 index 00000000000000..845853fe3008a8 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-05-06-15-11-23.bpo-36675.ddGwxG.rst @@ -0,0 +1 @@ +Fix a doctest detective documentation bug.