chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4a308400-ec15-4535-b1c0-4512fa5abb91 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,662 | supabase-export-v2 | d55dd5a538df6dae | if the example merely prints that traceback text. In practice, ordinary output rarely begins with a traceback header line, so this doesn't create real problems.
* Each line of the traceback stack (if present) must be indented further than
the first line of the example, *or* start with a non-alphanumeric character. The... | trusted_official_docs | CPython Docs | if the example merely prints that traceback text. In practice, ordinary output rarely begins with a traceback header line, so this doesn't create real problems.
* Each line of the traceback stack (if present) must be indented further than
the first line of the example, *or* start with a non-alphanumeric character. The... | if the example merely prints that traceback text. In practice, ordinary output rarely begins with a traceback header line, so this doesn't create real problems.
* Each line of the traceback stack (if present) must be indented further than
the first line of the example, *or* start with a non-alphanumeric character. The... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4d9c7fb9-1923-4029-81b0-19416f7065bf | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,764 | supabase-export-v2 | 53604f1d2394de5d | then the calling module's directory is used as the base directory for module-relative filenames. It is an error to specify *package* if *module_relative* is ``False``.
Optional argument *globs* gives a dict to be used as the globals when executing
examples. A new shallow copy of this dict is created for the doctest, s... | trusted_official_docs | CPython Docs | then the calling module's directory is used as the base directory for module-relative filenames. It is an error to specify *package* if *module_relative* is ``False``.
Optional argument *globs* gives a dict to be used as the globals when executing
examples. A new shallow copy of this dict is created for the doctest, s... | then the calling module's directory is used as the base directory for module-relative filenames. It is an error to specify *package* if *module_relative* is ``False``.
Optional argument *globs* gives a dict to be used as the globals when executing
examples. A new shallow copy of this dict is created for the doctest, s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4eebf02c-5df5-4da1-8bb7-d81c5fe90dac | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,967 | supabase-export-v2 | e05fa48f0f92e038 | when that line is executed. Then you can inspect current values of variables, and so on. For example, suppose :file:`a.py` contains just this module docstring::
"""
>>> def f(x):
... g(x*2)
>>> def g(x):
... print(x+3)
... import pdb; pdb.set_trace()
>>> f(3)
9
""" | trusted_official_docs | CPython Docs | when that line is executed. Then you can inspect current values of variables, and so on. For example, suppose :file:`a.py` contains just this module docstring::
"""
>>> def f(x):
... g(x*2)
>>> def g(x):
... print(x+3)
... import pdb; pdb.set_trace()
>>> f(3)
9
""" | when that line is executed. Then you can inspect current values of variables, and so on. For example, suppose :file:`a.py` contains just this module docstring::
"""
>>> def f(x):
... g(x*2)
>>> def g(x):
... print(x+3)
... import pdb; pdb.set_trace()
>>> f(3)
9
""" | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
52b58e95-c8e3-49b5-8f8a-262a59954b8c | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,652 | supabase-export-v2 | 1e7f6b9c1a946d64 | must start with a traceback header, which may be either of the following two lines, indented the same as the first line of the example::
Traceback (most recent call last):
Traceback (innermost last): | trusted_official_docs | CPython Docs | must start with a traceback header, which may be either of the following two lines, indented the same as the first line of the example::
Traceback (most recent call last):
Traceback (innermost last): | must start with a traceback header, which may be either of the following two lines, indented the same as the first line of the example::
Traceback (most recent call last):
Traceback (innermost last): | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
52d5a064-72b4-4703-a7b5-dc6a953d5d11 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,924 | supabase-export-v2 | c3d10387fe046e3c | .. method:: report_skip(out, test, example)
Report that the given example was skipped. This method is provided to
allow subclasses of :class:`DocTestRunner` to customize their output; it
should not be called directly. | trusted_official_docs | CPython Docs | .. method:: report_skip(out, test, example)
Report that the given example was skipped. This method is provided to
allow subclasses of :class:`DocTestRunner` to customize their output; it
should not be called directly. | .. method:: report_skip(out, test, example)
Report that the given example was skipped. This method is provided to
allow subclasses of :class:`DocTestRunner` to customize their output; it
should not be called directly. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
55ad6894-a1d9-4519-a223-41fa4416d145 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,632 | supabase-export-v2 | 9e782c6bc4caaacb | end of expected output. If expected output does contain a blank line, put ``<BLANKLINE>`` in your doctest example each place a blank line is expected.
* All hard tab characters are expanded to spaces, using 8-column tab stops. Tabs in output generated by the tested code are not modified. Because any
hard tabs in the s... | trusted_official_docs | CPython Docs | end of expected output. If expected output does contain a blank line, put ``<BLANKLINE>`` in your doctest example each place a blank line is expected.
* All hard tab characters are expanded to spaces, using 8-column tab stops. Tabs in output generated by the tested code are not modified. Because any
hard tabs in the s... | end of expected output. If expected output does contain a blank line, put ``<BLANKLINE>`` in your doctest example each place a blank line is expected.
* All hard tab characters are expanded to spaces, using 8-column tab stops. Tabs in output generated by the tested code are not modified. Because any
hard tabs in the s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
561eb637-36d8-4e0b-a3d3-4e7ff0582b7a | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 32,027 | supabase-export-v2 | d7c737e03e8d9d1b | Regression testing is best confined to dedicated objects or files. There are several options for organizing tests:
* Write text files containing test cases as interactive examples, and test the
files using :func:`testfile` or :func:`DocFileSuite`. This is recommended,
although is easiest to do for new projects, desig... | trusted_official_docs | CPython Docs | Regression testing is best confined to dedicated objects or files. There are several options for organizing tests:
* Write text files containing test cases as interactive examples, and test the
files using :func:`testfile` or :func:`DocFileSuite`. This is recommended,
although is easiest to do for new projects, desig... | Regression testing is best confined to dedicated objects or files. There are several options for organizing tests:
* Write text files containing test cases as interactive examples, and test the
files using :func:`testfile` or :func:`DocFileSuite`. This is recommended,
although is easiest to do for new projects, desig... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5698db81-7069-4a83-8a0a-72a41cf599ba | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,864 | supabase-export-v2 | aa1bd44b1aa81cae | .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None)
A single interactive example, consisting of a Python statement and its expected
output. The constructor arguments are used to initialize the attributes of
the same names. | trusted_official_docs | CPython Docs | .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None)
A single interactive example, consisting of a Python statement and its expected
output. The constructor arguments are used to initialize the attributes of
the same names. | .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None)
A single interactive example, consisting of a Python statement and its expected
output. The constructor arguments are used to initialize the attributes of
the same names. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
59002bbc-811d-4fc9-a896-4c3426b74c62 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,628 | supabase-export-v2 | 698b568ce14499a8 | = 12 >>> x 12 >>> if x == 13: ... print("yes") ... else: ... print("no") ... print("NO") ... print("NO!!!") ... no NO NO!!! >>>
.. index::
single: >>>; interpreter prompt
single: ...; interpreter prompt | trusted_official_docs | CPython Docs | = 12 >>> x 12 >>> if x == 13: ... print("yes") ... else: ... print("no") ... print("NO") ... print("NO!!!") ... no NO NO!!! >>>
.. index::
single: >>>; interpreter prompt
single: ...; interpreter prompt | = 12 >>> x 12 >>> if x == 13: ... print("yes") ... else: ... print("no") ... print("NO") ... print("NO!!!") ... no NO NO!!! >>>
.. index::
single: >>>; interpreter prompt
single: ...; interpreter prompt | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5939ad10-93e9-4bc2-950e-c56b401859de | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,824 | supabase-export-v2 | 71e53e881d530d8f | Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a subclass of :class:`!DocTestCase`.
So both ways of creating a :class:`unittest.TestSuite` run instances of
:class:`!DocTestCase`. This is important for a subtle reason: wh... | trusted_official_docs | CPython Docs | Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a subclass of :class:`!DocTestCase`.
So both ways of creating a :class:`unittest.TestSuite` run instances of
:class:`!DocTestCase`. This is important for a subtle reason: wh... | Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a subclass of :class:`!DocTestCase`.
So both ways of creating a :class:`unittest.TestSuite` run instances of
:class:`!DocTestCase`. This is important for a subtle reason: wh... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5a0c7b52-9d45-47e6-aedf-b9623c9fc705 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,884 | supabase-export-v2 | 8840b7992c20c9fd | The optional argument *parser* specifies the :class:`DocTestParser` object (or a drop-in replacement) that is used to extract doctests from docstrings.
If the optional argument *recurse* is false, then :meth:`DocTestFinder.find`
will only examine the given object, and not any contained objects. | trusted_official_docs | CPython Docs | The optional argument *parser* specifies the :class:`DocTestParser` object (or a drop-in replacement) that is used to extract doctests from docstrings.
If the optional argument *recurse* is false, then :meth:`DocTestFinder.find`
will only examine the given object, and not any contained objects. | The optional argument *parser* specifies the :class:`DocTestParser` object (or a drop-in replacement) that is used to extract doctests from docstrings.
If the optional argument *recurse* is false, then :meth:`DocTestFinder.find`
will only examine the given object, and not any contained objects. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5ab40895-4d25-45be-a198-c4ca371b7850 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,928 | supabase-export-v2 | 535856b6408cbf1d | .. method:: report_start(out, test, example)
Report that the test runner is about to process the given example. This method
is provided to allow subclasses of :class:`DocTestRunner` to customize their
output; it should not be called directly. | trusted_official_docs | CPython Docs | .. method:: report_start(out, test, example)
Report that the test runner is about to process the given example. This method
is provided to allow subclasses of :class:`DocTestRunner` to customize their
output; it should not be called directly. | .. method:: report_start(out, test, example)
Report that the test runner is about to process the given example. This method
is provided to allow subclasses of :class:`DocTestRunner` to customize their
output; it should not be called directly. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5aff989c-ab59-42db-a4f2-963b957bbae5 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,576 | supabase-export-v2 | f9e8d47096a36c46 | import doctest doctest.testfile("example.txt")
That short script executes and verifies any interactive Python examples
contained in the file :file:`example.txt`. The file content is treated as if it
were a single giant docstring; the file doesn't need to contain a Python
program! For example, perhaps :file:`example.txt... | trusted_official_docs | CPython Docs | import doctest doctest.testfile("example.txt")
That short script executes and verifies any interactive Python examples
contained in the file :file:`example.txt`. The file content is treated as if it
were a single giant docstring; the file doesn't need to contain a Python
program! For example, perhaps :file:`example.txt... | import doctest doctest.testfile("example.txt")
That short script executes and verifies any interactive Python examples
contained in the file :file:`example.txt`. The file content is treated as if it
were a single giant docstring; the file doesn't need to contain a Python
program! For example, perhaps :file:`example.txt... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5b576061-49c4-41e8-8be3-fa5f84943963 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,992 | supabase-export-v2 | d6fd771154843eaa | This is like function :func:`debug` above, except that a string containing doctest examples is specified directly, via the *src* argument.
Optional argument *pm* has the same meaning as in function :func:`debug` above. | trusted_official_docs | CPython Docs | This is like function :func:`debug` above, except that a string containing doctest examples is specified directly, via the *src* argument.
Optional argument *pm* has the same meaning as in function :func:`debug` above. | This is like function :func:`debug` above, except that a string containing doctest examples is specified directly, via the *src* argument.
Optional argument *pm* has the same meaning as in function :func:`debug` above. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5b664357-5ad4-4764-80c8-c6b52de9037b | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,997 | supabase-export-v2 | 62660dcb5d17f741 | example, and the original exception. If the output doesn't match, then a :exc:`DocTestFailure` exception is raised, containing the test, the example, and the actual output.
For information about the constructor parameters and methods, see the
documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-a... | trusted_official_docs | CPython Docs | example, and the original exception. If the output doesn't match, then a :exc:`DocTestFailure` exception is raised, containing the test, the example, and the actual output.
For information about the constructor parameters and methods, see the
documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-a... | example, and the original exception. If the output doesn't match, then a :exc:`DocTestFailure` exception is raised, containing the test, the example, and the actual output.
For information about the constructor parameters and methods, see the
documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5c6c2fa4-5381-4dc9-a515-4a8549819c60 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,837 | supabase-export-v2 | 56f1045c785c0617 | * :class:`DocTest`: A collection of :class:`Example`\ s, typically extracted from a single docstring or text file.
Additional processing classes are defined to find, parse, and run, and check
doctest examples: | trusted_official_docs | CPython Docs | * :class:`DocTest`: A collection of :class:`Example`\ s, typically extracted from a single docstring or text file.
Additional processing classes are defined to find, parse, and run, and check
doctest examples: | * :class:`DocTest`: A collection of :class:`Example`\ s, typically extracted from a single docstring or text file.
Additional processing classes are defined to find, parse, and run, and check
doctest examples: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5efdf816-8d3d-4f1f-a57f-0021478c5053 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,659 | supabase-export-v2 | ed3258373c914acb | >>> raise ValueError('multi\n line\ndetail') Traceback (most recent call last): ... ValueError: multi line detail
Note that tracebacks are treated very specially. In particular, in the
rewritten example, the use of ``...`` is independent of doctest's
:const:`ELLIPSIS` option. The ellipsis in that example could be left ... | trusted_official_docs | CPython Docs | >>> raise ValueError('multi\n line\ndetail') Traceback (most recent call last): ... ValueError: multi line detail
Note that tracebacks are treated very specially. In particular, in the
rewritten example, the use of ``...`` is independent of doctest's
:const:`ELLIPSIS` option. The ellipsis in that example could be left ... | >>> raise ValueError('multi\n line\ndetail') Traceback (most recent call last): ... ValueError: multi line detail
Note that tracebacks are treated very specially. In particular, in the
rewritten example, the use of ``...`` is independent of doctest's
:const:`ELLIPSIS` option. The ellipsis in that example could be left ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5f34ad1d-d0f4-4333-a20d-de7bd088cf5b | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,654 | supabase-export-v2 | 3034644d833e1c75 | followed by an optional traceback stack, whose contents are ignored by doctest. The traceback stack is typically omitted, or copied verbatim from an interactive session.
The traceback stack is followed by the most interesting part: the line(s)
containing the exception type and detail. This is usually the last line of a... | trusted_official_docs | CPython Docs | followed by an optional traceback stack, whose contents are ignored by doctest. The traceback stack is typically omitted, or copied verbatim from an interactive session.
The traceback stack is followed by the most interesting part: the line(s)
containing the exception type and detail. This is usually the last line of a... | followed by an optional traceback stack, whose contents are ignored by doctest. The traceback stack is typically omitted, or copied verbatim from an interactive session.
The traceback stack is followed by the most interesting part: the line(s)
containing the exception type and detail. This is usually the last line of a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
60501566-2721-4828-8fb1-8df829c5aa2a | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,760 | supabase-export-v2 | 741cbcaeba0eeb45 | Optional argument *module_relative* specifies how the filename should be interpreted:
* If *module_relative* is ``True`` (the default), then *filename* specifies an
OS-independent module-relative path. By default, this path is relative to the
calling module's directory; but if the *package* argument is specified, the... | trusted_official_docs | CPython Docs | Optional argument *module_relative* specifies how the filename should be interpreted:
* If *module_relative* is ``True`` (the default), then *filename* specifies an
OS-independent module-relative path. By default, this path is relative to the
calling module's directory; but if the *package* argument is specified, the... | Optional argument *module_relative* specifies how the filename should be interpreted:
* If *module_relative* is ``True`` (the default), then *filename* specifies an
OS-independent module-relative path. By default, this path is relative to the
calling module's directory; but if the *package* argument is specified, the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
60c319cc-b44d-43e2-a977-bb638f3c12c8 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,966 | supabase-export-v2 | 0d7d3f44b1cd2bb8 | * The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :meth:`debug` method defined by :class:`unittest.TestCase`.
* You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll
drop into the Python debugger when that line is executed. Then you can inspect
current values of variable... | trusted_official_docs | CPython Docs | * The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :meth:`debug` method defined by :class:`unittest.TestCase`.
* You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll
drop into the Python debugger when that line is executed. Then you can inspect
current values of variable... | * The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :meth:`debug` method defined by :class:`unittest.TestCase`.
* You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll
drop into the Python debugger when that line is executed. Then you can inspect
current values of variable... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6102ac69-8597-495e-9423-54dacefc3fda | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,673 | supabase-export-v2 | 77f2981d4467adb1 | functions. The names can also be used in :ref:`doctest directives <doctest-directives>`, and may be passed to the doctest command line interface via the ``-o`` option.
The first group of options define test semantics, controlling aspects of how
doctest decides whether actual output matches an example's expected output: | trusted_official_docs | CPython Docs | functions. The names can also be used in :ref:`doctest directives <doctest-directives>`, and may be passed to the doctest command line interface via the ``-o`` option.
The first group of options define test semantics, controlling aspects of how
doctest decides whether actual output matches an example's expected output: | functions. The names can also be used in :ref:`doctest directives <doctest-directives>`, and may be passed to the doctest command line interface via the ``-o`` option.
The first group of options define test semantics, controlling aspects of how
doctest decides whether actual output matches an example's expected output: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
610b7577-f085-4854-b663-592b8b3bbced | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,978 | supabase-export-v2 | c9e68b7e3cd073b8 | # Set x and y to 1 and 2. x, y = 1, 2 # # Print their sum: print(x+y) # Expected: ## 3
This function is used internally by other functions (see below), but can also be
useful when you want to transform an interactive Python session into a Python
script. | trusted_official_docs | CPython Docs | # Set x and y to 1 and 2. x, y = 1, 2 # # Print their sum: print(x+y) # Expected: ## 3
This function is used internally by other functions (see below), but can also be
useful when you want to transform an interactive Python session into a Python
script. | # Set x and y to 1 and 2. x, y = 1, 2 # # Print their sum: print(x+y) # Expected: ## 3
This function is used internally by other functions (see below), but can also be
useful when you want to transform an interactive Python session into a Python
script. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
63b71175-a356-4c03-8932-1ba77a4113f1 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,813 | supabase-export-v2 | 526157a4be70462b | Convert doctest tests for a module to a :class:`unittest.TestSuite`.
The returned :class:`unittest.TestSuite` is to be run by the unittest
framework and runs each doctest in the module. Each docstring is run as a separate unit test, and each example in
a docstring is run as a :ref:`subtest <subtests>`. If any of the ... | trusted_official_docs | CPython Docs | Convert doctest tests for a module to a :class:`unittest.TestSuite`.
The returned :class:`unittest.TestSuite` is to be run by the unittest
framework and runs each doctest in the module. Each docstring is run as a separate unit test, and each example in
a docstring is run as a :ref:`subtest <subtests>`. If any of the ... | Convert doctest tests for a module to a :class:`unittest.TestSuite`.
The returned :class:`unittest.TestSuite` is to be run by the unittest
framework and runs each doctest in the module. Each docstring is run as a separate unit test, and each example in
a docstring is run as a :ref:`subtest <subtests>`. If any of the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
63fe72ad-74e7-4e61-b4ff-4a665b3df4f0 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,932 | supabase-export-v2 | cd4b7cd8b31fe531 | that the given example ran successfully. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly.
*example* is the example about to be processed. *got* is the actual output
from the example. *test* is the test containing *example*. *out* is the
... | trusted_official_docs | CPython Docs | that the given example ran successfully. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly.
*example* is the example about to be processed. *got* is the actual output
from the example. *test* is the test containing *example*. *out* is the
... | that the given example ran successfully. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly.
*example* is the example about to be processed. *got* is the actual output
from the example. *test* is the test containing *example*. *out* is the
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
65a7000a-641d-4775-9f17-1046971aae15 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,636 | supabase-export-v2 | 52c00c6cac525461 | >>> def f(x): ... r'''Backslashes in a raw docstring: m\n''' ... >>> print(f.__doc__) Backslashes in a raw docstring: m\n
Otherwise, the backslash will be interpreted as part of the string. For example,
the ``\n`` above would be interpreted as a newline character. Alternatively, you
can double each backslash in the d... | trusted_official_docs | CPython Docs | >>> def f(x): ... r'''Backslashes in a raw docstring: m\n''' ... >>> print(f.__doc__) Backslashes in a raw docstring: m\n
Otherwise, the backslash will be interpreted as part of the string. For example,
the ``\n`` above would be interpreted as a newline character. Alternatively, you
can double each backslash in the d... | >>> def f(x): ... r'''Backslashes in a raw docstring: m\n''' ... >>> print(f.__doc__) Backslashes in a raw docstring: m\n
Otherwise, the backslash will be interpreted as part of the string. For example,
the ``\n`` above would be interpreted as a newline character. Alternatively, you
can double each backslash in the d... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67f890cc-99ed-481e-b77c-ce16915a2cc5 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,835 | supabase-export-v2 | db925d7733ee83b3 | The advanced API revolves around two container classes, which are used to store the interactive examples extracted from doctest cases:
* :class:`Example`: A single Python :term:`statement`, paired with its expected
output. | trusted_official_docs | CPython Docs | The advanced API revolves around two container classes, which are used to store the interactive examples extracted from doctest cases:
* :class:`Example`: A single Python :term:`statement`, paired with its expected
output. | The advanced API revolves around two container classes, which are used to store the interactive examples extracted from doctest cases:
* :class:`Example`: A single Python :term:`statement`, paired with its expected
output. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
68167cff-6ec2-4c69-9b1a-b5dd13b9a5e4 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,657 | supabase-export-v2 | e1fc48a78021035a | The last three lines (starting with :exc:`ValueError`) are compared against the exception's type and detail, and the rest are ignored.
Best practice is to omit the traceback stack, unless it adds significant
documentation value to the example. So the last example is probably better as:: | trusted_official_docs | CPython Docs | The last three lines (starting with :exc:`ValueError`) are compared against the exception's type and detail, and the rest are ignored.
Best practice is to omit the traceback stack, unless it adds significant
documentation value to the example. So the last example is probably better as:: | The last three lines (starting with :exc:`ValueError`) are compared against the exception's type and detail, and the rest are ignored.
Best practice is to omit the traceback stack, unless it adds significant
documentation value to the example. So the last example is probably better as:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
68fd9dfd-a95f-4fcc-906c-10ce0ba36308 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,689 | supabase-export-v2 | 21afcfa0599eac05 | >>> raise Exception('message') Traceback (most recent call last): __main__.Exception: message
Note that :const:`ELLIPSIS` can also be used to ignore the
details of the exception message, but such a test may still fail based
on whether the module name is present or matches exactly. | trusted_official_docs | CPython Docs | >>> raise Exception('message') Traceback (most recent call last): __main__.Exception: message
Note that :const:`ELLIPSIS` can also be used to ignore the
details of the exception message, but such a test may still fail based
on whether the module name is present or matches exactly. | >>> raise Exception('message') Traceback (most recent call last): __main__.Exception: message
Note that :const:`ELLIPSIS` can also be used to ignore the
details of the exception message, but such a test may still fail based
on whether the module name is present or matches exactly. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6ce6c9a4-1762-429f-be4e-78a52dc9564e | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,664 | supabase-export-v2 | 4ed443f8b18a1885 | * When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, everything following the leftmost colon and any module information in the exception name is ignored.
* The interactive shell omits the traceback header line for some
:exc:`SyntaxError`\ s. But doctest uses the traceback header line to
distinguis... | trusted_official_docs | CPython Docs | * When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, everything following the leftmost colon and any module information in the exception name is ignored.
* The interactive shell omits the traceback header line for some
:exc:`SyntaxError`\ s. But doctest uses the traceback header line to
distinguis... | * When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, everything following the leftmost colon and any module information in the exception name is ignored.
* The interactive shell omits the traceback header line for some
:exc:`SyntaxError`\ s. But doctest uses the traceback header line to
distinguis... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6d1af859-bb59-4773-8395-7cba7f06ed9b | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,556 | supabase-export-v2 | 72e487badd19aace | large ok 2 items passed all tests: 1 test in __main__ 6 tests in __main__.factorial 7 tests in 2 items. 7 passed. Test passed. $
That's all you need to know to start making productive use of :mod:`!doctest`! Jump in. The following sections provide full details. Note that there are many
examples of doctests in the stand... | trusted_official_docs | CPython Docs | large ok 2 items passed all tests: 1 test in __main__ 6 tests in __main__.factorial 7 tests in 2 items. 7 passed. Test passed. $
That's all you need to know to start making productive use of :mod:`!doctest`! Jump in. The following sections provide full details. Note that there are many
examples of doctests in the stand... | large ok 2 items passed all tests: 1 test in __main__ 6 tests in __main__.factorial 7 tests in 2 items. 7 passed. Test passed. $
That's all you need to know to start making productive use of :mod:`!doctest`! Jump in. The following sections provide full details. Note that there are many
examples of doctests in the stand... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6d1e9489-759d-4867-999f-7fe8764b8a6b | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,806 | supabase-export-v2 | 2cb0109d3bab3fd3 | initial global variables for the tests. A new copy of this dictionary is created for each test. By default, *globs* is a new empty dictionary.
Optional argument *optionflags* specifies the default doctest options for the
tests, created by or-ing together individual option flags. See section
:ref:`doctest-options`. Se... | trusted_official_docs | CPython Docs | initial global variables for the tests. A new copy of this dictionary is created for each test. By default, *globs* is a new empty dictionary.
Optional argument *optionflags* specifies the default doctest options for the
tests, created by or-ing together individual option flags. See section
:ref:`doctest-options`. Se... | initial global variables for the tests. A new copy of this dictionary is created for each test. By default, *globs* is a new empty dictionary.
Optional argument *optionflags* specifies the default doctest options for the
tests, created by or-ing together individual option flags. See section
:ref:`doctest-options`. Se... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6e3c4a1f-426e-4ae7-b061-74b54b2090d6 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,989 | supabase-export-v2 | d23163b6aad28eca | *pm* is not specified, or is false, the script is run under the debugger from the start, via passing an appropriate :func:`exec` call to :func:`pdb.run`.
.. function:: debug_src(src, pm=False, globs=None) | trusted_official_docs | CPython Docs | *pm* is not specified, or is false, the script is run under the debugger from the start, via passing an appropriate :func:`exec` call to :func:`pdb.run`.
.. function:: debug_src(src, pm=False, globs=None) | *pm* is not specified, or is false, the script is run under the debugger from the start, via passing an appropriate :func:`exec` call to :func:`pdb.run`.
.. function:: debug_src(src, pm=False, globs=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6f6660e4-e3ea-417a-bf4d-ed3b2f820219 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,889 | supabase-export-v2 | cc86cf42f651d989 | Return a list of the :class:`DocTest`\ s that are defined by *obj*'s docstring, or by any of its contained objects' docstrings.
The optional argument *name* specifies the object's name; this name will be
used to construct names for the returned :class:`DocTest`\ s. If *name* is
not specified, then ``obj.__name__`` is... | trusted_official_docs | CPython Docs | Return a list of the :class:`DocTest`\ s that are defined by *obj*'s docstring, or by any of its contained objects' docstrings.
The optional argument *name* specifies the object's name; this name will be
used to construct names for the returned :class:`DocTest`\ s. If *name* is
not specified, then ``obj.__name__`` is... | Return a list of the :class:`DocTest`\ s that are defined by *obj*'s docstring, or by any of its contained objects' docstrings.
The optional argument *name* specifies the object's name; this name will be
used to construct names for the returned :class:`DocTest`\ s. If *name* is
not specified, then ``obj.__name__`` is... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6f89c391-8bba-4b45-8660-ba42f8b25c60 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,921 | supabase-export-v2 | e87e14e0ac640789 | be used to control how the test runner compares expected output to actual output, and how it displays failures. For more information, see section :ref:`doctest-options`.
The test runner accumulates statistics. The aggregated number of attempted,
failed and skipped examples is also available via the :attr:`tries`,
:at... | trusted_official_docs | CPython Docs | be used to control how the test runner compares expected output to actual output, and how it displays failures. For more information, see section :ref:`doctest-options`.
The test runner accumulates statistics. The aggregated number of attempted,
failed and skipped examples is also available via the :attr:`tries`,
:at... | be used to control how the test runner compares expected output to actual output, and how it displays failures. For more information, see section :ref:`doctest-options`.
The test runner accumulates statistics. The aggregated number of attempted,
failed and skipped examples is also available via the :attr:`tries`,
:at... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
71a50e57-8ec8-467e-bc82-1e1e60146de3 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,586 | supabase-export-v2 | 270a0355b23840b3 | directory. See section :ref:`doctest-basic-api` for a description of the optional arguments that can be used to tell it to look for files in other locations.
Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the
``-v`` command-line switch or with the optional keyword argument
*verbose*. | trusted_official_docs | CPython Docs | directory. See section :ref:`doctest-basic-api` for a description of the optional arguments that can be used to tell it to look for files in other locations.
Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the
``-v`` command-line switch or with the optional keyword argument
*verbose*. | directory. See section :ref:`doctest-basic-api` for a description of the optional arguments that can be used to tell it to look for files in other locations.
Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the
``-v`` command-line switch or with the optional keyword argument
*verbose*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
725ad8f1-93c3-4fdb-a90d-19cbaa9e5547 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 32,024 | supabase-export-v2 | bf9a5c7f726a7dc0 | as the years go by and things change. I'm still amazed at how often one of my :mod:`!doctest` examples stops working after a "harmless" change.
Doctest also makes an excellent tool for regression testing, especially if you
don't skimp on explanatory text. By interleaving prose and examples, it becomes
much easier to ke... | trusted_official_docs | CPython Docs | as the years go by and things change. I'm still amazed at how often one of my :mod:`!doctest` examples stops working after a "harmless" change.
Doctest also makes an excellent tool for regression testing, especially if you
don't skimp on explanatory text. By interleaving prose and examples, it becomes
much easier to ke... | as the years go by and things change. I'm still amazed at how often one of my :mod:`!doctest` examples stops working after a "harmless" change.
Doctest also makes an excellent tool for regression testing, especially if you
don't skimp on explanatory text. By interleaving prose and examples, it becomes
much easier to ke... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73332672-230f-4723-9025-0ea894defae0 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,585 | supabase-export-v2 | eb8ad01171509d30 | If an example does fail, then the failing example(s) and the cause(s) of the failure(s) are printed to stdout, using the same format as :func:`!testmod`.
By default, :func:`testfile` looks for files in the calling module's directory. See section :ref:`doctest-basic-api` for a description of the optional arguments
that ... | trusted_official_docs | CPython Docs | If an example does fail, then the failing example(s) and the cause(s) of the failure(s) are printed to stdout, using the same format as :func:`!testmod`.
By default, :func:`testfile` looks for files in the calling module's directory. See section :ref:`doctest-basic-api` for a description of the optional arguments
that ... | If an example does fail, then the failing example(s) and the cause(s) of the failure(s) are printed to stdout, using the same format as :func:`!testmod`.
By default, :func:`testfile` looks for files in the calling module's directory. See section :ref:`doctest-basic-api` for a description of the optional arguments
that ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
74acfbbe-138d-41d1-a124-2d8404a3a2ac | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,614 | supabase-export-v2 | 8c1a02a8d9fc563c | found from ``M.__test__`` are searched, and strings are treated as if they were docstrings. In output, a key ``K`` in ``M.__test__`` appears with name ``M.__test__.K``.
For example, place this block of code at the top of :file:`example.py`: | trusted_official_docs | CPython Docs | found from ``M.__test__`` are searched, and strings are treated as if they were docstrings. In output, a key ``K`` in ``M.__test__`` appears with name ``M.__test__.K``.
For example, place this block of code at the top of :file:`example.py`: | found from ``M.__test__`` are searched, and strings are treated as if they were docstrings. In output, a key ``K`` in ``M.__test__`` appears with name ``M.__test__.K``.
For example, place this block of code at the top of :file:`example.py`: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
74c4c219-f589-4584-8484-170442a18c27 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,803 | supabase-export-v2 | 9bf47a20a9a09e04 | then the calling module's directory is used as the base directory for module-relative filenames. It is an error to specify *package* if *module_relative* is ``False``.
Optional argument *setUp* specifies a set-up function for the test suite. This is called before running the tests in each file. The *setUp* function
wi... | trusted_official_docs | CPython Docs | then the calling module's directory is used as the base directory for module-relative filenames. It is an error to specify *package* if *module_relative* is ``False``.
Optional argument *setUp* specifies a set-up function for the test suite. This is called before running the tests in each file. The *setUp* function
wi... | then the calling module's directory is used as the base directory for module-relative filenames. It is an error to specify *package* if *module_relative* is ``False``.
Optional argument *setUp* specifies a set-up function for the test suite. This is called before running the tests in each file. The *setUp* function
wi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
750c586d-0d94-4031-8a10-2afe75da2b5a | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,801 | supabase-export-v2 | 900813607f4a0d2e | OS-independence, each filename should use ``/`` characters to separate path segments, and may not be an absolute path (i.e., it may not begin with ``/``).
* If *module_relative* is ``False``, then each filename in *paths* specifies
an OS-specific path. The path may be absolute or relative; relative paths
are resolved... | trusted_official_docs | CPython Docs | OS-independence, each filename should use ``/`` characters to separate path segments, and may not be an absolute path (i.e., it may not begin with ``/``).
* If *module_relative* is ``False``, then each filename in *paths* specifies
an OS-specific path. The path may be absolute or relative; relative paths
are resolved... | OS-independence, each filename should use ``/`` characters to separate path segments, and may not be an absolute path (i.e., it may not begin with ``/``).
* If *module_relative* is ``False``, then each filename in *paths* specifies
an OS-specific path. The path may be absolute or relative; relative paths
are resolved... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7524c8b5-79b8-4ff9-9dd4-b187fa9551fe | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,800 | supabase-export-v2 | 3d13f92217116242 | Optional argument *module_relative* specifies how the filenames in *paths* should be interpreted:
* If *module_relative* is ``True`` (the default), then each filename in
*paths* specifies an OS-independent module-relative path. By default, this
path is relative to the calling module's directory; but if the *package*
... | trusted_official_docs | CPython Docs | Optional argument *module_relative* specifies how the filenames in *paths* should be interpreted:
* If *module_relative* is ``True`` (the default), then each filename in
*paths* specifies an OS-independent module-relative path. By default, this
path is relative to the calling module's directory; but if the *package*
... | Optional argument *module_relative* specifies how the filenames in *paths* should be interpreted:
* If *module_relative* is ``True`` (the default), then each filename in
*paths* specifies an OS-independent module-relative path. By default, this
path is relative to the calling module's directory; but if the *package*
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7549b816-8756-475c-93a7-d2707c58d968 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,660 | supabase-export-v2 | 717e9fd52c328789 | be left out, or could just as well be three (or three hundred) commas or digits, or an indented transcript of a Monty Python skit.
Some details you should read once, but won't need to remember: | trusted_official_docs | CPython Docs | be left out, or could just as well be three (or three hundred) commas or digits, or an indented transcript of a Monty Python skit.
Some details you should read once, but won't need to remember: | be left out, or could just as well be three (or three hundred) commas or digits, or an indented transcript of a Monty Python skit.
Some details you should read once, but won't need to remember: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7610ffe4-9812-4ee6-b554-d3d6530f853d | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,817 | supabase-export-v2 | c4287f64eae6e12f | Optional argument *extraglobs* specifies an extra set of global variables, which is merged into *globs*. By default, no extra globals are used.
Optional argument *test_finder* is the :class:`DocTestFinder` object (or a
drop-in replacement) that is used to extract doctests from the module. | trusted_official_docs | CPython Docs | Optional argument *extraglobs* specifies an extra set of global variables, which is merged into *globs*. By default, no extra globals are used.
Optional argument *test_finder* is the :class:`DocTestFinder` object (or a
drop-in replacement) that is used to extract doctests from the module. | Optional argument *extraglobs* specifies an extra set of global variables, which is merged into *globs*. By default, no extra globals are used.
Optional argument *test_finder* is the :class:`DocTestFinder` object (or a
drop-in replacement) that is used to extract doctests from the module. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
79039ac2-892e-45b6-ab4f-de840563bfca | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,929 | supabase-export-v2 | 538f44d52150bfe7 | about to process the given example. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly.
*example* is the example about to be processed. *test* is the test
containing *example*. *out* is the output function that was passed to
:meth:`DocTest... | trusted_official_docs | CPython Docs | about to process the given example. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly.
*example* is the example about to be processed. *test* is the test
containing *example*. *out* is the output function that was passed to
:meth:`DocTest... | about to process the given example. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly.
*example* is the example about to be processed. *test* is the test
containing *example*. *out* is the output function that was passed to
:meth:`DocTest... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
79cb38c6-e339-4041-8bad-326ad8eeb969 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,973 | supabase-export-v2 | 633ca15eb8aaac4e | Convert text with examples to a script.
Argument *s* is a string containing doctest examples. The string is converted
to a Python script, where doctest examples in *s* are converted to regular code,
and everything else is converted to Python comments. The generated script is
returned as a string. For example, :: | trusted_official_docs | CPython Docs | Convert text with examples to a script.
Argument *s* is a string containing doctest examples. The string is converted
to a Python script, where doctest examples in *s* are converted to regular code,
and everything else is converted to Python comments. The generated script is
returned as a string. For example, :: | Convert text with examples to a script.
Argument *s* is a string containing doctest examples. The string is converted
to a Python script, where doctest examples in *s* are converted to regular code,
and everything else is converted to Python comments. The generated script is
returned as a string. For example, :: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7af8ea2d-a8ae-40a4-93a9-d8521e6fb5a1 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,981 | supabase-export-v2 | d63b3e3b294ac077 | Convert the doctest for an object to a script.
Argument *module* is a module object, or dotted name of a module, containing the
object whose doctests are of interest. Argument *name* is the name (within the
module) of the object with the doctests of interest. The result is a string,
containing the object's docstring... | trusted_official_docs | CPython Docs | Convert the doctest for an object to a script.
Argument *module* is a module object, or dotted name of a module, containing the
object whose doctests are of interest. Argument *name* is the name (within the
module) of the object with the doctests of interest. The result is a string,
containing the object's docstring... | Convert the doctest for an object to a script.
Argument *module* is a module object, or dotted name of a module, containing the
object whose doctests are of interest. Argument *name* is the name (within the
module) of the object with the doctests of interest. The result is a string,
containing the object's docstring... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7b96b29a-42ff-4599-88b8-6c0541c3d704 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,964 | supabase-export-v2 | a2add48de0829ba9 | * Several functions convert doctests to executable Python programs, which can be run under the Python debugger, :mod:`pdb`.
* The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that
raises an exception for the first failing example, containing information about
that example. This information can b... | trusted_official_docs | CPython Docs | * Several functions convert doctests to executable Python programs, which can be run under the Python debugger, :mod:`pdb`.
* The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that
raises an exception for the first failing example, containing information about
that example. This information can b... | * Several functions convert doctests to executable Python programs, which can be run under the Python debugger, :mod:`pdb`.
* The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that
raises an exception for the first failing example, containing information about
that example. This information can b... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7c5ed801-2c8a-49d6-897e-e6894b5fbbbd | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,883 | supabase-export-v2 | c2d8a012a7a98d62 | The optional argument *verbose* can be used to display the objects searched by the finder. It defaults to ``False`` (no output).
The optional argument *parser* specifies the :class:`DocTestParser` object (or a
drop-in replacement) that is used to extract doctests from docstrings. | trusted_official_docs | CPython Docs | The optional argument *verbose* can be used to display the objects searched by the finder. It defaults to ``False`` (no output).
The optional argument *parser* specifies the :class:`DocTestParser` object (or a
drop-in replacement) that is used to extract doctests from docstrings. | The optional argument *verbose* can be used to display the objects searched by the finder. It defaults to ``False`` (no output).
The optional argument *parser* specifies the :class:`DocTestParser` object (or a
drop-in replacement) that is used to extract doctests from docstrings. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7dd21245-79b7-46da-a8a2-e535f4368b8e | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,956 | supabase-export-v2 | 8ce7db3eb74d9629 | which compares a given pair of outputs, and returns ``True`` if they match; and :meth:`output_difference`, which returns a string describing the differences between two outputs.
:class:`OutputChecker` defines the following methods: | trusted_official_docs | CPython Docs | which compares a given pair of outputs, and returns ``True`` if they match; and :meth:`output_difference`, which returns a string describing the differences between two outputs.
:class:`OutputChecker` defines the following methods: | which compares a given pair of outputs, and returns ``True`` if they match; and :meth:`output_difference`, which returns a string describing the differences between two outputs.
:class:`OutputChecker` defines the following methods: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7e343fd1-3b86-4e48-bf24-3c44ecc3f4eb | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,736 | supabase-export-v2 | de313bb2f1adf9a0 | Warnings ^^^^^^^^
:mod:`!doctest` is serious about requiring exact matches in expected output. If
even a single character doesn't match, the test fails. This will probably
surprise you a few times, as you learn exactly what Python does and doesn't
guarantee about output. For example, when printing a set, Python doesn't... | trusted_official_docs | CPython Docs | Warnings ^^^^^^^^
:mod:`!doctest` is serious about requiring exact matches in expected output. If
even a single character doesn't match, the test fails. This will probably
surprise you a few times, as you learn exactly what Python does and doesn't
guarantee about output. For example, when printing a set, Python doesn't... | Warnings ^^^^^^^^
:mod:`!doctest` is serious about requiring exact matches in expected output. If
even a single character doesn't match, the test fails. This will probably
surprise you a few times, as you learn exactly what Python does and doesn't
guarantee about output. For example, when printing a set, Python doesn't... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7fac0070-0c33-4d8d-8636-18f9b19db919 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,780 | supabase-export-v2 | 3aacb0aa957d27d4 | <DocTestRunner.summarize>` in conjunction with :func:`testmod` continues to get output for objects with no tests. The *exclude_empty* argument to the newer :class:`DocTestFinder` constructor defaults to true.
Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*,
*raise_on_error*, and *globs* are the sam... | trusted_official_docs | CPython Docs | <DocTestRunner.summarize>` in conjunction with :func:`testmod` continues to get output for objects with no tests. The *exclude_empty* argument to the newer :class:`DocTestFinder` constructor defaults to true.
Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*,
*raise_on_error*, and *globs* are the sam... | <DocTestRunner.summarize>` in conjunction with :func:`testmod` continues to get output for objects with no tests. The *exclude_empty* argument to the newer :class:`DocTestFinder` constructor defaults to true.
Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*,
*raise_on_error*, and *globs* are the sam... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80c6e763-627b-40d2-8888-fd750622c88e | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,871 | supabase-export-v2 | e282b3b1935c560e | .. attribute:: exc_msg
The exception message generated by the example, if the example is expected to
generate an exception; or ``None`` if it is not expected to generate an
exception. This exception message is compared against the return value of
:func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a n... | trusted_official_docs | CPython Docs | .. attribute:: exc_msg
The exception message generated by the example, if the example is expected to
generate an exception; or ``None`` if it is not expected to generate an
exception. This exception message is compared against the return value of
:func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a n... | .. attribute:: exc_msg
The exception message generated by the example, if the example is expected to
generate an exception; or ``None`` if it is not expected to generate an
exception. This exception message is compared against the return value of
:func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a n... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80ca0cd9-4c72-40a8-b7c5-3d83b8abf5b7 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,816 | supabase-export-v2 | 4d081e219f6a27ae | the initial global variables for the tests. A new copy of this dictionary is created for each test. By default, *globs* is the module's :attr:`~module.__dict__`.
Optional argument *extraglobs* specifies an extra set of global variables, which
is merged into *globs*. By default, no extra globals are used. | trusted_official_docs | CPython Docs | the initial global variables for the tests. A new copy of this dictionary is created for each test. By default, *globs* is the module's :attr:`~module.__dict__`.
Optional argument *extraglobs* specifies an extra set of global variables, which
is merged into *globs*. By default, no extra globals are used. | the initial global variables for the tests. A new copy of this dictionary is created for each test. By default, *globs* is the module's :attr:`~module.__dict__`.
Optional argument *extraglobs* specifies an extra set of global variables, which
is merged into *globs*. By default, no extra globals are used. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8167c340-72e5-42b5-93fc-968f206a02f3 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,916 | supabase-export-v2 | 1a6e0df984d7d03c | A processing class used to execute and verify the interactive examples in a :class:`DocTest`.
The comparison between expected outputs and actual outputs is done by an
:class:`OutputChecker`. This comparison may be customized with a number of
option flags; see section :ref:`doctest-options` for more information. If th... | trusted_official_docs | CPython Docs | A processing class used to execute and verify the interactive examples in a :class:`DocTest`.
The comparison between expected outputs and actual outputs is done by an
:class:`OutputChecker`. This comparison may be customized with a number of
option flags; see section :ref:`doctest-options` for more information. If th... | A processing class used to execute and verify the interactive examples in a :class:`DocTest`.
The comparison between expected outputs and actual outputs is done by an
:class:`OutputChecker`. This comparison may be customized with a number of
option flags; see section :ref:`doctest-options` for more information. If th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
82575f54-6f31-4155-97a5-20e8205d4b24 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,545 | supabase-export-v2 | a1fe5876fc23df09 | It must also not be ridiculously large: >>> factorial(1e100) Traceback (most recent call last): ... OverflowError: n too large """
import math
if not n >= 0:
raise ValueError("n must be >= 0")
if math.floor(n) != n:
raise ValueError("n must be exact integer")
if n+1 == n: # catch a value like 1e300
raise Overflow... | trusted_official_docs | CPython Docs | It must also not be ridiculously large: >>> factorial(1e100) Traceback (most recent call last): ... OverflowError: n too large """
import math
if not n >= 0:
raise ValueError("n must be >= 0")
if math.floor(n) != n:
raise ValueError("n must be exact integer")
if n+1 == n: # catch a value like 1e300
raise Overflow... | It must also not be ridiculously large: >>> factorial(1e100) Traceback (most recent call last): ... OverflowError: n too large """
import math
if not n >= 0:
raise ValueError("n must be >= 0")
if math.floor(n) != n:
raise ValueError("n must be exact integer")
if n+1 == n: # catch a value like 1e300
raise Overflow... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
832b124e-c939-410b-8be4-3b66b06b3add | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,668 | supabase-export-v2 | 39dd1aa5fae4e9b1 | >>> 1 + None File "<stdin>", line 1 1 + None ~~^~~~~~ TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
Since the lines showing the position of the error come before the exception type
and detail, they are not checked by doctest. For example, the following test
would pass, even though it puts the ``^... | trusted_official_docs | CPython Docs | >>> 1 + None File "<stdin>", line 1 1 + None ~~^~~~~~ TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
Since the lines showing the position of the error come before the exception type
and detail, they are not checked by doctest. For example, the following test
would pass, even though it puts the ``^... | >>> 1 + None File "<stdin>", line 1 1 + None ~~^~~~~~ TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
Since the lines showing the position of the error come before the exception type
and detail, they are not checked by doctest. For example, the following test
would pass, even though it puts the ``^... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
838254ee-797e-420e-b8a7-19c81fe9f35c | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,557 | supabase-export-v2 | 84ff7c0790302837 | are many examples of doctests in the standard Python test suite and libraries. Especially useful examples can be found in the standard test file :file:`Lib/test/test_doctest/test_doctest.py`.
.. versionadded:: 3.13
Output is colorized by default and can be
:ref:`controlled using environment variables <using-on-contro... | trusted_official_docs | CPython Docs | are many examples of doctests in the standard Python test suite and libraries. Especially useful examples can be found in the standard test file :file:`Lib/test/test_doctest/test_doctest.py`.
.. versionadded:: 3.13
Output is colorized by default and can be
:ref:`controlled using environment variables <using-on-contro... | are many examples of doctests in the standard Python test suite and libraries. Especially useful examples can be found in the standard test file :file:`Lib/test/test_doctest/test_doctest.py`.
.. versionadded:: 3.13
Output is colorized by default and can be
:ref:`controlled using environment variables <using-on-contro... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8423955b-ab68-4b96-890c-ddcfbf9d239c | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,908 | supabase-export-v2 | 550702b3df50d896 | .. method:: parse(string, name='<string>')
Divide the given string into examples and intervening text, and return them as
a list of alternating :class:`Example`\ s and strings. Line numbers for the
:class:`!Example`\ s are 0-based. The optional argument *name* is a name
identifying this string, and is only used for ... | trusted_official_docs | CPython Docs | .. method:: parse(string, name='<string>')
Divide the given string into examples and intervening text, and return them as
a list of alternating :class:`Example`\ s and strings. Line numbers for the
:class:`!Example`\ s are 0-based. The optional argument *name* is a name
identifying this string, and is only used for ... | .. method:: parse(string, name='<string>')
Divide the given string into examples and intervening text, and return them as
a list of alternating :class:`Example`\ s and strings. Line numbers for the
:class:`!Example`\ s are 0-based. The optional argument *name* is a name
identifying this string, and is only used for ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
847aa537-8d7e-4b82-9bbd-50dc4c5ae0e8 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,709 | supabase-export-v2 | 7ddfca6a832d5038 | A bitmask or'ing together all the reporting flags above.
There is also a way to register new option flag names, though this isn't
useful unless you intend to extend :mod:`!doctest` internals via subclassing: | trusted_official_docs | CPython Docs | A bitmask or'ing together all the reporting flags above.
There is also a way to register new option flag names, though this isn't
useful unless you intend to extend :mod:`!doctest` internals via subclassing: | A bitmask or'ing together all the reporting flags above.
There is also a way to register new option flag names, though this isn't
useful unless you intend to extend :mod:`!doctest` internals via subclassing: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
847b8f0a-820f-4dca-95d1-f750aeee6a20 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,767 | supabase-export-v2 | b9258a9779d7cb1e | of stuff if true, and prints only failures if false; by default, or if ``None``, it's true if and only if ``'-v'`` is in :data:`sys.argv`.
Optional argument *report* prints a summary at the end when true, else prints
nothing at the end. In verbose mode, the summary is detailed, else the summary
is very brief (in fact... | trusted_official_docs | CPython Docs | of stuff if true, and prints only failures if false; by default, or if ``None``, it's true if and only if ``'-v'`` is in :data:`sys.argv`.
Optional argument *report* prints a summary at the end when true, else prints
nothing at the end. In verbose mode, the summary is detailed, else the summary
is very brief (in fact... | of stuff if true, and prints only failures if false; by default, or if ``None``, it's true if and only if ``'-v'`` is in :data:`sys.argv`.
Optional argument *report* prints a summary at the end when true, else prints
nothing at the end. In verbose mode, the summary is detailed, else the summary
is very brief (in fact... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84b7c958-a6c6-4d3e-9740-3558e3c8850b | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,974 | supabase-export-v2 | 9578d7a4823dbd07 | *s* are converted to regular code, and everything else is converted to Python comments. The generated script is returned as a string. For example, ::
import doctest
print(doctest.script_from_examples(r"""
Set x and y to 1 and 2. >>> x, y = 1, 2 | trusted_official_docs | CPython Docs | *s* are converted to regular code, and everything else is converted to Python comments. The generated script is returned as a string. For example, ::
import doctest
print(doctest.script_from_examples(r"""
Set x and y to 1 and 2. >>> x, y = 1, 2 | *s* are converted to regular code, and everything else is converted to Python comments. The generated script is returned as a string. For example, ::
import doctest
print(doctest.script_from_examples(r"""
Set x and y to 1 and 2. >>> x, y = 1, 2 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
86111276-5583-4b01-964b-ac39ed14a5fd | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,847 | supabase-export-v2 | 66aceca89bc22296 | .. class:: DocTest(examples, globs, name, filename, lineno, docstring)
A collection of doctest examples that should be run in a single namespace. The
constructor arguments are used to initialize the attributes of the same names. | trusted_official_docs | CPython Docs | .. class:: DocTest(examples, globs, name, filename, lineno, docstring)
A collection of doctest examples that should be run in a single namespace. The
constructor arguments are used to initialize the attributes of the same names. | .. class:: DocTest(examples, globs, name, filename, lineno, docstring)
A collection of doctest examples that should be run in a single namespace. The
constructor arguments are used to initialize the attributes of the same names. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
861c6cd5-9132-4183-a128-d8bde072d8d0 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,986 | supabase-export-v2 | 2027a7b0a634857d | Debug the doctests for an object.
The *module* and *name* arguments are the same as for function
:func:`testsource` above. The synthesized Python script for the named object's
docstring is written to a temporary file, and then that file is run under the
control of the Python debugger, :mod:`pdb`. | trusted_official_docs | CPython Docs | Debug the doctests for an object.
The *module* and *name* arguments are the same as for function
:func:`testsource` above. The synthesized Python script for the named object's
docstring is written to a temporary file, and then that file is run under the
control of the Python debugger, :mod:`pdb`. | Debug the doctests for an object.
The *module* and *name* arguments are the same as for function
:func:`testsource` above. The synthesized Python script for the named object's
docstring is written to a temporary file, and then that file is run under the
control of the Python debugger, :mod:`pdb`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
86bfce33-7924-4132-9c5f-4877a7b9df83 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,618 | supabase-export-v2 | f9d44c8283563e9d | >>> [factorial(n) for n in range(6)] [1, 1, 2, 6, 24, 120] """ }
The value of ``example.__test__["numbers"]`` will be treated as a
docstring and all the tests inside it will be run. It is
important to note that the value can be mapped to a function,
class object, or module; if so, :mod:`!doctest`
searches them recursiv... | trusted_official_docs | CPython Docs | >>> [factorial(n) for n in range(6)] [1, 1, 2, 6, 24, 120] """ }
The value of ``example.__test__["numbers"]`` will be treated as a
docstring and all the tests inside it will be run. It is
important to note that the value can be mapped to a function,
class object, or module; if so, :mod:`!doctest`
searches them recursiv... | >>> [factorial(n) for n in range(6)] [1, 1, 2, 6, 24, 120] """ }
The value of ``example.__test__["numbers"]`` will be treated as a
docstring and all the tests inside it will be run. It is
important to note that the value can be mapped to a function,
class object, or module; if so, :mod:`!doctest`
searches them recursiv... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
879851b4-cfb6-4d77-bd3a-1391b4e424f2 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,711 | supabase-export-v2 | 60a6e71e3187d6b9 | .. function:: register_optionflag(name)
Create a new option flag with a given name, and return the new flag's integer
value. :func:`register_optionflag` can be used when subclassing
:class:`OutputChecker` or :class:`DocTestRunner` to create new options that are
supported by your subclasses. :func:`register_optionfla... | trusted_official_docs | CPython Docs | .. function:: register_optionflag(name)
Create a new option flag with a given name, and return the new flag's integer
value. :func:`register_optionflag` can be used when subclassing
:class:`OutputChecker` or :class:`DocTestRunner` to create new options that are
supported by your subclasses. :func:`register_optionfla... | .. function:: register_optionflag(name)
Create a new option flag with a given name, and return the new flag's integer
value. :func:`register_optionflag` can be used when subclassing
:class:`OutputChecker` or :class:`DocTestRunner` to create new options that are
supported by your subclasses. :func:`register_optionfla... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
87ee803f-7eac-43d5-bce8-165996507ec3 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,750 | supabase-export-v2 | 9f2fac868809b13e | output variations across platforms, because Python defers to the platform C library for some floating-point calculations, and C libraries vary widely in quality here. ::
>>> 1000**0.1 # risky
1.9952623149688797
>>> round(1000**0.1, 9) # safer
1.995262315
>>> print(f'{1000**0.1:.4f}') # much safer
1.9953 | trusted_official_docs | CPython Docs | output variations across platforms, because Python defers to the platform C library for some floating-point calculations, and C libraries vary widely in quality here. ::
>>> 1000**0.1 # risky
1.9952623149688797
>>> round(1000**0.1, 9) # safer
1.995262315
>>> print(f'{1000**0.1:.4f}') # much safer
1.9953 | output variations across platforms, because Python defers to the platform C library for some floating-point calculations, and C libraries vary widely in quality here. ::
>>> 1000**0.1 # risky
1.9952623149688797
>>> round(1000**0.1, 9) # safer
1.995262315
>>> print(f'{1000**0.1:.4f}') # much safer
1.9953 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
88cd1ae8-c987-48ea-ac71-fec8dc8988f4 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 32,009 | supabase-export-v2 | 2a51bd111ce8b174 | .. exception:: UnexpectedException(test, example, exc_info)
An exception raised by :class:`DocTestRunner` to signal that a doctest
example raised an unexpected exception. The constructor arguments are used
to initialize the attributes of the same names. | trusted_official_docs | CPython Docs | .. exception:: UnexpectedException(test, example, exc_info)
An exception raised by :class:`DocTestRunner` to signal that a doctest
example raised an unexpected exception. The constructor arguments are used
to initialize the attributes of the same names. | .. exception:: UnexpectedException(test, example, exc_info)
An exception raised by :class:`DocTestRunner` to signal that a doctest
example raised an unexpected exception. The constructor arguments are used
to initialize the attributes of the same names. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
890a56bd-8dc9-4462-858d-47fb1ed48bfd | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,734 | supabase-export-v2 | 781d9fe06a965752 | >>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40))) ... # doctest: +ELLIPSIS [0, ..., 4, 10, ..., 19, 30, ..., 39]
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
usually the only meaningful ch... | trusted_official_docs | CPython Docs | >>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40))) ... # doctest: +ELLIPSIS [0, ..., 4, 10, ..., 19, 30, ..., 39]
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
usually the only meaningful ch... | >>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40))) ... # doctest: +ELLIPSIS [0, ..., 4, 10, ..., 19, 30, ..., 39]
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
usually the only meaningful ch... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8bdfc1bc-aeca-4c66-957e-647f0185bcc2 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 32,010 | supabase-export-v2 | a574a05a6b20a9f1 | by :class:`DocTestRunner` to signal that a doctest example raised an unexpected exception. The constructor arguments are used to initialize the attributes of the same names.
:exc:`UnexpectedException` defines the following attributes: | trusted_official_docs | CPython Docs | by :class:`DocTestRunner` to signal that a doctest example raised an unexpected exception. The constructor arguments are used to initialize the attributes of the same names.
:exc:`UnexpectedException` defines the following attributes: | by :class:`DocTestRunner` to signal that a doctest example raised an unexpected exception. The constructor arguments are used to initialize the attributes of the same names.
:exc:`UnexpectedException` defines the following attributes: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8daf54d1-2e93-4b4e-b9ce-388cd596f4e7 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,790 | supabase-export-v2 | e552b82c553bbf0b | Unittest API ------------
As your collection of doctest'ed modules grows, you'll want a way to run all
their doctests systematically. :mod:`!doctest` provides two functions that can
be used to create :mod:`unittest` test suites from modules and text files
containing doctests. To integrate with :mod:`unittest` test disc... | trusted_official_docs | CPython Docs | Unittest API ------------
As your collection of doctest'ed modules grows, you'll want a way to run all
their doctests systematically. :mod:`!doctest` provides two functions that can
be used to create :mod:`unittest` test suites from modules and text files
containing doctests. To integrate with :mod:`unittest` test disc... | Unittest API ------------
As your collection of doctest'ed modules grows, you'll want a way to run all
their doctests systematically. :mod:`!doctest` provides two functions that can
be used to create :mod:`unittest` test suites from modules and text files
containing doctests. To integrate with :mod:`unittest` test disc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8e44c532-3c34-424d-85d3-1de305c39aab | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,818 | supabase-export-v2 | fea73b0761159f22 | Optional argument *test_finder* is the :class:`DocTestFinder` object (or a drop-in replacement) that is used to extract doctests from the module.
Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as for
function :func:`DocFileSuite` above, but they are called for each docstring. | trusted_official_docs | CPython Docs | Optional argument *test_finder* is the :class:`DocTestFinder` object (or a drop-in replacement) that is used to extract doctests from the module.
Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as for
function :func:`DocFileSuite` above, but they are called for each docstring. | Optional argument *test_finder* is the :class:`DocTestFinder` object (or a drop-in replacement) that is used to extract doctests from the module.
Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as for
function :func:`DocFileSuite` above, but they are called for each docstring. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8f3af5ca-0e53-479e-84a2-34c376c82979 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,676 | supabase-export-v2 | 0b938ef8cbaff35e | from integer to boolean; doctests expecting "little integer" output still work in these cases. This option will probably go away, but not for several years.
.. index:: single: <BLANKLINE>
.. data:: DONT_ACCEPT_BLANKLINE | trusted_official_docs | CPython Docs | from integer to boolean; doctests expecting "little integer" output still work in these cases. This option will probably go away, but not for several years.
.. index:: single: <BLANKLINE>
.. data:: DONT_ACCEPT_BLANKLINE | from integer to boolean; doctests expecting "little integer" output still work in these cases. This option will probably go away, but not for several years.
.. index:: single: <BLANKLINE>
.. data:: DONT_ACCEPT_BLANKLINE | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90557d06-9593-48be-b99f-6715b501e95a | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,635 | supabase-export-v2 | 420db34086a17a0b | session, or for any other reason use a backslash, you should use a raw docstring, which will preserve your backslashes exactly as you type them::
>>> def f(x):
... r'''Backslashes in a raw docstring: m\n'''
... >>> print(f.__doc__)
Backslashes in a raw docstring: m\n | trusted_official_docs | CPython Docs | session, or for any other reason use a backslash, you should use a raw docstring, which will preserve your backslashes exactly as you type them::
>>> def f(x):
... r'''Backslashes in a raw docstring: m\n'''
... >>> print(f.__doc__)
Backslashes in a raw docstring: m\n | session, or for any other reason use a backslash, you should use a raw docstring, which will preserve your backslashes exactly as you type them::
>>> def f(x):
... r'''Backslashes in a raw docstring: m\n'''
... >>> print(f.__doc__)
Backslashes in a raw docstring: m\n | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9111926b-9812-47c2-9b42-94c5246d4af7 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,805 | supabase-export-v2 | 9adb678dbd22e17c | The *tearDown* function will be passed a :class:`DocTest` object. The *tearDown* function can access the test globals as the :attr:`~DocTest.globs` attribute of the test passed.
Optional argument *globs* is a dictionary containing the initial global
variables for the tests. A new copy of this dictionary is created for... | trusted_official_docs | CPython Docs | The *tearDown* function will be passed a :class:`DocTest` object. The *tearDown* function can access the test globals as the :attr:`~DocTest.globs` attribute of the test passed.
Optional argument *globs* is a dictionary containing the initial global
variables for the tests. A new copy of this dictionary is created for... | The *tearDown* function will be passed a :class:`DocTest` object. The *tearDown* function can access the test globals as the :attr:`~DocTest.globs` attribute of the test passed.
Optional argument *globs* is a dictionary containing the initial global
variables for the tests. A new copy of this dictionary is created for... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9492688a-d5ea-4710-a78c-ea8ab36a784f | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,770 | supabase-export-v2 | 1192d86fc2b60077 | raised upon the first failure or unexpected exception in an example. This allows failures to be post-mortem debugged. Default behavior is to continue running examples.
Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) that
should be used to extract tests from the files. It defaults to a norma... | trusted_official_docs | CPython Docs | raised upon the first failure or unexpected exception in an example. This allows failures to be post-mortem debugged. Default behavior is to continue running examples.
Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) that
should be used to extract tests from the files. It defaults to a norma... | raised upon the first failure or unexpected exception in an example. This allows failures to be post-mortem debugged. Default behavior is to continue running examples.
Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) that
should be used to extract tests from the files. It defaults to a norma... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9600125d-3ccd-4ded-bc37-91a03bbe4a31 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,776 | supabase-export-v2 | d68f7a31d7fc505f | maps names (strings) to functions, classes and strings; function and class docstrings are searched for examples; strings are searched directly, as if they were docstrings.
Only docstrings attached to objects belonging to module *m* are searched. | trusted_official_docs | CPython Docs | maps names (strings) to functions, classes and strings; function and class docstrings are searched for examples; strings are searched directly, as if they were docstrings.
Only docstrings attached to objects belonging to module *m* are searched. | maps names (strings) to functions, classes and strings; function and class docstrings are searched for examples; strings are searched directly, as if they were docstrings.
Only docstrings attached to objects belonging to module *m* are searched. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
96b9d01f-7738-4ac7-92bc-0f235d4371be | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,920 | supabase-export-v2 | 462a17f8cc31bae3 | is ``False``, then only failures are printed. If *verbose* is unspecified, or ``None``, then verbose output is used iff the command-line switch ``-v`` is used.
The optional keyword argument *optionflags* can be used to control how the test
runner compares expected output to actual output, and how it displays failures.... | trusted_official_docs | CPython Docs | is ``False``, then only failures are printed. If *verbose* is unspecified, or ``None``, then verbose output is used iff the command-line switch ``-v`` is used.
The optional keyword argument *optionflags* can be used to control how the test
runner compares expected output to actual output, and how it displays failures.... | is ``False``, then only failures are printed. If *verbose* is unspecified, or ``None``, then verbose output is used iff the command-line switch ``-v`` is used.
The optional keyword argument *optionflags* can be used to control how the test
runner compares expected output to actual output, and how it displays failures.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
97463303-ff8e-4be0-918e-e70b2beb29a8 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,679 | supabase-export-v2 | 25ebda45f81bce5a | .. data:: NORMALIZE_WHITESPACE
When specified, all sequences of whitespace (blanks and newlines) are treated as
equal. Any sequence of whitespace within the expected output will match any
sequence of whitespace within the actual output. By default, whitespace must
match exactly. :const:`NORMALIZE_WHITESPACE` is espe... | trusted_official_docs | CPython Docs | .. data:: NORMALIZE_WHITESPACE
When specified, all sequences of whitespace (blanks and newlines) are treated as
equal. Any sequence of whitespace within the expected output will match any
sequence of whitespace within the actual output. By default, whitespace must
match exactly. :const:`NORMALIZE_WHITESPACE` is espe... | .. data:: NORMALIZE_WHITESPACE
When specified, all sequences of whitespace (blanks and newlines) are treated as
equal. Any sequence of whitespace within the expected output will match any
sequence of whitespace within the actual output. By default, whitespace must
match exactly. :const:`NORMALIZE_WHITESPACE` is espe... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9894e851-ec63-45d7-9362-1fba8bb064d1 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,807 | supabase-export-v2 | 2198d8e21ddaeb91 | for the tests, created by or-ing together individual option flags. See section :ref:`doctest-options`. See function :func:`set_unittest_reportflags` below for a better way to set reporting options.
Optional argument *parser* specifies a :class:`DocTestParser` (or subclass)
that should be used to extract tests from the... | trusted_official_docs | CPython Docs | for the tests, created by or-ing together individual option flags. See section :ref:`doctest-options`. See function :func:`set_unittest_reportflags` below for a better way to set reporting options.
Optional argument *parser* specifies a :class:`DocTestParser` (or subclass)
that should be used to extract tests from the... | for the tests, created by or-ing together individual option flags. See section :ref:`doctest-options`. See function :func:`set_unittest_reportflags` below for a better way to set reporting options.
Optional argument *parser* specifies a :class:`DocTestParser` (or subclass)
that should be used to extract tests from the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
99f97f78-1d87-4e32-a463-9dd637c8945d | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,704 | supabase-export-v2 | d4a2507bb95b7328 | .. data:: REPORT_ONLY_FIRST_FAILURE
When specified, display the first failing example in each doctest, but suppress
output for all remaining examples. This will prevent doctest from reporting
correct examples that break because of earlier failures; but it might also hide
incorrect examples that fail independently of... | trusted_official_docs | CPython Docs | .. data:: REPORT_ONLY_FIRST_FAILURE
When specified, display the first failing example in each doctest, but suppress
output for all remaining examples. This will prevent doctest from reporting
correct examples that break because of earlier failures; but it might also hide
incorrect examples that fail independently of... | .. data:: REPORT_ONLY_FIRST_FAILURE
When specified, display the first failing example in each doctest, but suppress
output for all remaining examples. This will prevent doctest from reporting
correct examples that break because of earlier failures; but it might also hide
incorrect examples that fail independently of... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9a59dd29-5ca1-47c3-900d-2fa32683a74d | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,906 | supabase-export-v2 | 7638150b60b42ce6 | .. method:: get_examples(string, name='<string>')
Extract all doctest examples from the given string, and return them as a list
of :class:`Example` objects. Line numbers are 0-based. The optional argument
*name* is a name identifying this string, and is only used for error messages. | trusted_official_docs | CPython Docs | .. method:: get_examples(string, name='<string>')
Extract all doctest examples from the given string, and return them as a list
of :class:`Example` objects. Line numbers are 0-based. The optional argument
*name* is a name identifying this string, and is only used for error messages. | .. method:: get_examples(string, name='<string>')
Extract all doctest examples from the given string, and return them as a list
of :class:`Example` objects. Line numbers are 0-based. The optional argument
*name* is a name identifying this string, and is only used for error messages. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9bb8e41c-2919-4baf-bdb1-75be02d25cef | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,570 | supabase-export-v2 | a2474993c368598e | or prohibit it by passing ``verbose=False``. In either of those cases, :data:`sys.argv` is not examined by :func:`testmod` (so passing ``-v`` or not has no effect).
There is also a command line shortcut for running :func:`testmod`, see section
:ref:`doctest-cli`. | trusted_official_docs | CPython Docs | or prohibit it by passing ``verbose=False``. In either of those cases, :data:`sys.argv` is not examined by :func:`testmod` (so passing ``-v`` or not has no effect).
There is also a command line shortcut for running :func:`testmod`, see section
:ref:`doctest-cli`. | or prohibit it by passing ``verbose=False``. In either of those cases, :data:`sys.argv` is not examined by :func:`testmod` (so passing ``-v`` or not has no effect).
There is also a command line shortcut for running :func:`testmod`, see section
:ref:`doctest-cli`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9dd070dc-66cb-42c6-972d-eb01cb49318e | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,829 | supabase-export-v2 | dab1cfe6524e9f2e | Argument *flags* takes the :ref:`bitwise OR <bitwise>` of option flags. See section :ref:`doctest-options`. Only "reporting flags" can be used.
This is a module-global setting, and affects all future doctests run by module
:mod:`unittest`: the :meth:`!runTest` method of :class:`!DocTestCase` looks at
the option flags... | trusted_official_docs | CPython Docs | Argument *flags* takes the :ref:`bitwise OR <bitwise>` of option flags. See section :ref:`doctest-options`. Only "reporting flags" can be used.
This is a module-global setting, and affects all future doctests run by module
:mod:`unittest`: the :meth:`!runTest` method of :class:`!DocTestCase` looks at
the option flags... | Argument *flags* takes the :ref:`bitwise OR <bitwise>` of option flags. See section :ref:`doctest-options`. Only "reporting flags" can be used.
This is a module-global setting, and affects all future doctests run by module
:mod:`unittest`: the :meth:`!runTest` method of :class:`!DocTestCase` looks at
the option flags... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9fe0970e-2a65-466a-8534-b2123558de96 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,587 | supabase-export-v2 | 2f08ca42be2e3f87 | Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-v`` command-line switch or with the optional keyword argument *verbose*.
There is also a command line shortcut for running :func:`testfile`, see section
:ref:`doctest-cli`. | trusted_official_docs | CPython Docs | Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-v`` command-line switch or with the optional keyword argument *verbose*.
There is also a command line shortcut for running :func:`testfile`, see section
:ref:`doctest-cli`. | Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-v`` command-line switch or with the optional keyword argument *verbose*.
There is also a command line shortcut for running :func:`testfile`, see section
:ref:`doctest-cli`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a079cfb3-7b7f-446e-81f1-354ae4bf4ca0 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,717 | supabase-export-v2 | c0aed18957f0d414 | .. productionlist:: doctest directive: "#" "doctest:" `directive_options` directive_options: `directive_option` ("," `directive_option`)* directive_option: `on_or_off` `directive_option_name` on_or_off: "+" | "-" directive_option_name: "DONT_ACCEPT_BLANKLINE" | "NORMALIZE_WHITESPACE" | ...
Whitespace is not allowed bet... | trusted_official_docs | CPython Docs | .. productionlist:: doctest directive: "#" "doctest:" `directive_options` directive_options: `directive_option` ("," `directive_option`)* directive_option: `on_or_off` `directive_option_name` on_or_off: "+" | "-" directive_option_name: "DONT_ACCEPT_BLANKLINE" | "NORMALIZE_WHITESPACE" | ...
Whitespace is not allowed bet... | .. productionlist:: doctest directive: "#" "doctest:" `directive_options` directive_options: `directive_option` ("," `directive_option`)* directive_option: `on_or_off` `directive_option_name` on_or_off: "+" | "-" directive_option_name: "DONT_ACCEPT_BLANKLINE" | "NORMALIZE_WHITESPACE" | ...
Whitespace is not allowed bet... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a1f080e8-e209-4ad5-9905-5520708a0806 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,796 | supabase-export-v2 | 2cd9eea8423df58f | Convert doctest tests from one or more text files to a :class:`unittest.TestSuite`.
The returned :class:`unittest.TestSuite` is to be run by the unittest
framework and runs the interactive examples in each file. Each file is run as a separate unit test, and each example in a file
is run as a :ref:`subtest <subtests>`... | trusted_official_docs | CPython Docs | Convert doctest tests from one or more text files to a :class:`unittest.TestSuite`.
The returned :class:`unittest.TestSuite` is to be run by the unittest
framework and runs the interactive examples in each file. Each file is run as a separate unit test, and each example in a file
is run as a :ref:`subtest <subtests>`... | Convert doctest tests from one or more text files to a :class:`unittest.TestSuite`.
The returned :class:`unittest.TestSuite` is to be run by the unittest
framework and runs the interactive examples in each file. Each file is run as a separate unit test, and each example in a file
is run as a :ref:`subtest <subtests>`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a23b16cb-9e9d-48b9-baea-73e66d12f38c | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,681 | supabase-export-v2 | f9c327459438e7c9 | .. index:: single: ...; in doctests .. data:: ELLIPSIS
When specified, an ellipsis marker (``...``) in the expected output can match
any substring in the actual output. This includes substrings that span line
boundaries, and empty substrings, so it's best to keep usage of this simple. Complicated uses can lead to the... | trusted_official_docs | CPython Docs | .. index:: single: ...; in doctests .. data:: ELLIPSIS
When specified, an ellipsis marker (``...``) in the expected output can match
any substring in the actual output. This includes substrings that span line
boundaries, and empty substrings, so it's best to keep usage of this simple. Complicated uses can lead to the... | .. index:: single: ...; in doctests .. data:: ELLIPSIS
When specified, an ellipsis marker (``...``) in the expected output can match
any substring in the actual output. This includes substrings that span line
boundaries, and empty substrings, so it's best to keep usage of this simple. Complicated uses can lead to the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a24ce501-f2a5-4627-a2b4-96b8b5c669cf | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,834 | supabase-export-v2 | 4ee3c6bb379a63dd | most users' needs; however, if you require more fine-grained control over testing, or wish to extend doctest's capabilities, then you should use the advanced API.
The advanced API revolves around two container classes, which are used to store
the interactive examples extracted from doctest cases: | trusted_official_docs | CPython Docs | most users' needs; however, if you require more fine-grained control over testing, or wish to extend doctest's capabilities, then you should use the advanced API.
The advanced API revolves around two container classes, which are used to store
the interactive examples extracted from doctest cases: | most users' needs; however, if you require more fine-grained control over testing, or wish to extend doctest's capabilities, then you should use the advanced API.
The advanced API revolves around two container classes, which are used to store
the interactive examples extracted from doctest cases: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a46a16ea-f7e9-4e7f-8b5d-6468dbfacc4f | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,658 | supabase-export-v2 | 9660e621ed0be217 | Best practice is to omit the traceback stack, unless it adds significant documentation value to the example. So the last example is probably better as::
>>> raise ValueError('multi\n line\ndetail')
Traceback (most recent call last):
... ValueError: multi
line
detail | trusted_official_docs | CPython Docs | Best practice is to omit the traceback stack, unless it adds significant documentation value to the example. So the last example is probably better as::
>>> raise ValueError('multi\n line\ndetail')
Traceback (most recent call last):
... ValueError: multi
line
detail | Best practice is to omit the traceback stack, unless it adds significant documentation value to the example. So the last example is probably better as::
>>> raise ValueError('multi\n line\ndetail')
Traceback (most recent call last):
... ValueError: multi
line
detail | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a4760c34-1273-4f1d-a421-bdc29308e4c7 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,919 | supabase-export-v2 | 53d0e0bd18dd167f | argument *checker* specifies the :class:`OutputChecker` object (or drop-in replacement) that should be used to compare the expected outputs to the actual outputs of doctest examples.
The optional keyword argument *verbose* controls the :class:`DocTestRunner`'s
verbosity. If *verbose* is ``True``, then information is p... | trusted_official_docs | CPython Docs | argument *checker* specifies the :class:`OutputChecker` object (or drop-in replacement) that should be used to compare the expected outputs to the actual outputs of doctest examples.
The optional keyword argument *verbose* controls the :class:`DocTestRunner`'s
verbosity. If *verbose* is ``True``, then information is p... | argument *checker* specifies the :class:`OutputChecker` object (or drop-in replacement) that should be used to compare the expected outputs to the actual outputs of doctest examples.
The optional keyword argument *verbose* controls the :class:`DocTestRunner`'s
verbosity. If *verbose* is ``True``, then information is p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a55b2840-92d6-4a3c-be92-707b99f33001 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 32,001 | supabase-export-v2 | 2831be739847ea1d | that a doctest example's actual output did not match its expected output. The constructor arguments are used to initialize the attributes of the same names.
:exc:`DocTestFailure` defines the following attributes: | trusted_official_docs | CPython Docs | that a doctest example's actual output did not match its expected output. The constructor arguments are used to initialize the attributes of the same names.
:exc:`DocTestFailure` defines the following attributes: | that a doctest example's actual output did not match its expected output. The constructor arguments are used to initialize the attributes of the same names.
:exc:`DocTestFailure` defines the following attributes: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a673f23d-6aad-4361-b62e-69b5409c6ff0 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,644 | supabase-export-v2 | 5be5f8299a97008b | use any names defined at top-level in :mod:`!M`, and names defined earlier in the docstring being run. Examples cannot see names defined in other docstrings.
You can force use of your own dict as the execution context by passing
``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead. | trusted_official_docs | CPython Docs | use any names defined at top-level in :mod:`!M`, and names defined earlier in the docstring being run. Examples cannot see names defined in other docstrings.
You can force use of your own dict as the execution context by passing
``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead. | use any names defined at top-level in :mod:`!M`, and names defined earlier in the docstring being run. Examples cannot see names defined in other docstrings.
You can force use of your own dict as the execution context by passing
``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a78bf236-ad58-4415-8087-76101efd0105 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,663 | supabase-export-v2 | aa192f023b3a4e91 | and starting with an alphanumeric is taken to be the start of the exception detail. Of course this does the right thing for genuine tracebacks.
* When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified,
everything following the leftmost colon and any module information in the
exception name is ignored. | trusted_official_docs | CPython Docs | and starting with an alphanumeric is taken to be the start of the exception detail. Of course this does the right thing for genuine tracebacks.
* When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified,
everything following the leftmost colon and any module information in the
exception name is ignored. | and starting with an alphanumeric is taken to be the start of the exception detail. Of course this does the right thing for genuine tracebacks.
* When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified,
everything following the leftmost colon and any module information in the
exception name is ignored. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a8f1ffc5-6933-48c2-8fad-a56e1b782ba9 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,786 | supabase-export-v2 | ad3215d1f5d7f330 | argument *verbose* is true, output is generated even if there are no failures. By default, output is generated only in case of an example failure.
Optional argument *compileflags* gives the set of flags that should be used by
the Python compiler when running the examples. By default, or if ``None``,
flags are deduced... | trusted_official_docs | CPython Docs | argument *verbose* is true, output is generated even if there are no failures. By default, output is generated only in case of an example failure.
Optional argument *compileflags* gives the set of flags that should be used by
the Python compiler when running the examples. By default, or if ``None``,
flags are deduced... | argument *verbose* is true, output is generated even if there are no failures. By default, output is generated only in case of an example failure.
Optional argument *compileflags* gives the set of flags that should be used by
the Python compiler when running the examples. By default, or if ``None``,
flags are deduced... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a8ffb810-4af1-4f87-ae0a-995a95122b14 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,839 | supabase-export-v2 | ddcf8b75d94b0a7e | * :class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :class:`DocTestParser` to create a :class:`DocTest` from every docstring that contains interactive examples.
* :class:`DocTestParser`: Creates a :class:`DocTest` object from a string (such
as an object's docstring). | trusted_official_docs | CPython Docs | * :class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :class:`DocTestParser` to create a :class:`DocTest` from every docstring that contains interactive examples.
* :class:`DocTestParser`: Creates a :class:`DocTest` object from a string (such
as an object's docstring). | * :class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :class:`DocTestParser` to create a :class:`DocTest` from every docstring that contains interactive examples.
* :class:`DocTestParser`: Creates a :class:`DocTest` object from a string (such
as an object's docstring). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aa634712-8fed-41ae-9349-ddd62ffe6333 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,933 | supabase-export-v2 | 33b6703cd49b9fcc | processed. *got* is the actual output from the example. *test* is the test containing *example*. *out* is the output function that was passed to :meth:`DocTestRunner.run`.
.. method:: report_failure(out, test, example, got) | trusted_official_docs | CPython Docs | processed. *got* is the actual output from the example. *test* is the test containing *example*. *out* is the output function that was passed to :meth:`DocTestRunner.run`.
.. method:: report_failure(out, test, example, got) | processed. *got* is the actual output from the example. *test* is the test containing *example*. *out* is the output function that was passed to :meth:`DocTestRunner.run`.
.. method:: report_failure(out, test, example, got) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ab9de087-fdc4-4215-a0a3-6c55e870c04d | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 32,030 | supabase-export-v2 | e8d1a5465e36f37a | * Define a :attr:`~module.__test__` dictionary mapping from regression test topics to docstrings containing test cases.
When you have placed your tests in a module, the module can itself be the test
runner. When a test fails, you can arrange for your test runner to re-run only
the failing doctest while you debug the pr... | trusted_official_docs | CPython Docs | * Define a :attr:`~module.__test__` dictionary mapping from regression test topics to docstrings containing test cases.
When you have placed your tests in a module, the module can itself be the test
runner. When a test fails, you can arrange for your test runner to re-run only
the failing doctest while you debug the pr... | * Define a :attr:`~module.__test__` dictionary mapping from regression test topics to docstrings containing test cases.
When you have placed your tests in a module, the module can itself be the test
runner. When a test fails, you can arrange for your test runner to re-run only
the failing doctest while you debug the pr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ac3bc1b6-833b-4f53-9866-7ee2784282cc | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,631 | supabase-export-v2 | 7eadf1bce6e2f245 | The fine print:
* Expected output cannot contain an all-whitespace line, since such a line is
taken to signal the end of expected output. If expected output does contain a
blank line, put ``<BLANKLINE>`` in your doctest example each place a blank line
is expected. | trusted_official_docs | CPython Docs | The fine print:
* Expected output cannot contain an all-whitespace line, since such a line is
taken to signal the end of expected output. If expected output does contain a
blank line, put ``<BLANKLINE>`` in your doctest example each place a blank line
is expected. | The fine print:
* Expected output cannot contain an all-whitespace line, since such a line is
taken to signal the end of expected output. If expected output does contain a
blank line, put ``<BLANKLINE>`` in your doctest example each place a blank line
is expected. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
acd28bc2-ddb3-4ae9-b046-af9b2499a2fd | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,771 | supabase-export-v2 | 44cbb3cea4eb9856 | argument *parser* specifies a :class:`DocTestParser` (or subclass) that should be used to extract tests from the files. It defaults to a normal parser (i.e., ``DocTestParser()``).
Optional argument *encoding* specifies an encoding that should be used to
convert the file to unicode. | trusted_official_docs | CPython Docs | argument *parser* specifies a :class:`DocTestParser` (or subclass) that should be used to extract tests from the files. It defaults to a normal parser (i.e., ``DocTestParser()``).
Optional argument *encoding* specifies an encoding that should be used to
convert the file to unicode. | argument *parser* specifies a :class:`DocTestParser` (or subclass) that should be used to extract tests from the files. It defaults to a normal parser (i.e., ``DocTestParser()``).
Optional argument *encoding* specifies an encoding that should be used to
convert the file to unicode. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
add9c43b-2d9c-4d07-97b7-5a6e3278ab90 | CPython Docs | file://datasets/cpython/Doc/library/doctest.rst | unknown | 9dfc0366-85b7-4875-8297-1456569ff54b | 31,675 | supabase-export-v2 | c611240ae0751925 | .. data:: DONT_ACCEPT_TRUE_FOR_1
By default, if an expected output block contains just ``1``, an actual output
block containing just ``1`` or just ``True`` is considered to be a match, and
similarly for ``0`` versus ``False``. When :const:`DONT_ACCEPT_TRUE_FOR_1` is
specified, neither substitution is allowed. The de... | trusted_official_docs | CPython Docs | .. data:: DONT_ACCEPT_TRUE_FOR_1
By default, if an expected output block contains just ``1``, an actual output
block containing just ``1`` or just ``True`` is considered to be a match, and
similarly for ``0`` versus ``False``. When :const:`DONT_ACCEPT_TRUE_FOR_1` is
specified, neither substitution is allowed. The de... | .. data:: DONT_ACCEPT_TRUE_FOR_1
By default, if an expected output block contains just ``1``, an actual output
block containing just ``1`` or just ``True`` is considered to be a match, and
similarly for ``0`` versus ``False``. When :const:`DONT_ACCEPT_TRUE_FOR_1` is
specified, neither substitution is allowed. The de... | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.