Kaydet (Commit) 8f80a5ba authored tarafından Georg Brandl's avatar Georg Brandl

Need to use list(range()) to get a list.

üst 99cd9577
...@@ -625,7 +625,7 @@ example. Use ``+`` to enable the named behavior, or ``-`` to disable it. ...@@ -625,7 +625,7 @@ example. Use ``+`` to enable the named behavior, or ``-`` to disable it.
For example, this test passes:: For example, this test passes::
>>> print(range(20)) #doctest: +NORMALIZE_WHITESPACE >>> print(list(range(20))) #doctest: +NORMALIZE_WHITESPACE
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19] 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
...@@ -634,28 +634,28 @@ two blanks before the single-digit list elements, and because the actual output ...@@ -634,28 +634,28 @@ 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 is on a single line. This test also passes, and also requires a directive to do
so:: so::
>>> print(range(20)) # doctest: +ELLIPSIS >>> print(list(range(20))) # doctest: +ELLIPSIS
[0, 1, ..., 18, 19] [0, 1, ..., 18, 19]
Multiple directives can be used on a single physical line, separated by commas:: Multiple directives can be used on a single physical line, separated by commas::
>>> print(range(20)) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE >>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
[0, 1, ..., 18, 19] [0, 1, ..., 18, 19]
If multiple directive comments are used for a single example, then they are If multiple directive comments are used for a single example, then they are
combined:: combined::
>>> print(range(20)) # doctest: +ELLIPSIS >>> print(list(range(20))) # doctest: +ELLIPSIS
... # doctest: +NORMALIZE_WHITESPACE ... # doctest: +NORMALIZE_WHITESPACE
[0, 1, ..., 18, 19] [0, 1, ..., 18, 19]
As the previous example shows, you can add ``...`` lines to your example 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 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(range(5) + range(10,20) + range(30,40) + range(50,60)) >>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))
... # doctest: +ELLIPSIS ... # doctest: +ELLIPSIS
[0, ..., 4, 10, ..., 19, 30, ..., 39, 50, ..., 59] [0, ..., 4, 10, ..., 19, 30, ..., 39]
Note that since all options are disabled by default, and directives apply only Note that since all options are disabled by default, and directives apply only
to the example they appear in, enabling options (via ``+`` in a directive) is to the example they appear in, enabling options (via ``+`` in a directive) is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment