Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
7b51a55e
Kaydet (Commit)
7b51a55e
authored
Eyl 18, 2015
tarafından
Ethan Furman
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue24756: clarify usage of run_docstring_examples()
üst
8e3b04c7
2a5f9da5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
doctest.rst
Doc/library/doctest.rst
+23
-7
No files found.
Doc/library/doctest.rst
Dosyayı görüntüle @
7b51a55e
...
@@ -914,15 +914,10 @@ and :ref:`doctest-simple-testfile`.
...
@@ -914,15 +914,10 @@ and :ref:`doctest-simple-testfile`.
above, except that *globs* defaults to ``m.__dict__``.
above, except that *globs* defaults to ``m.__dict__``.
There'
s
also
a
function
to
run
the
doctests
associated
with
a
single
object
.
This
function
is
provided
for
backward
compatibility
.
There
are
no
plans
to
deprecate
it
,
but
it
's rarely useful:
.. function:: run_docstring_examples(f, globs, verbose=False, name="NoName", compileflags=None, optionflags=0)
.. function:: run_docstring_examples(f, globs, verbose=False, name="NoName", compileflags=None, optionflags=0)
Test examples associated with object *f*; for example, *f* may be a
module
,
Test examples associated with object *f*; for example, *f* may be a
string
,
function, or
class object.
a module, a function, or a
class object.
A shallow copy of dictionary argument *globs* is used for the execution context.
A shallow copy of dictionary argument *globs* is used for the execution context.
...
@@ -1815,6 +1810,27 @@ several options for organizing tests:
...
@@ -1815,6 +1810,27 @@ several options for organizing tests:
*
Define
a
``
__test__
``
dictionary
mapping
from
regression
test
topics
to
*
Define
a
``
__test__
``
dictionary
mapping
from
regression
test
topics
to
docstrings
containing
test
cases
.
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
problem
.
Here
is
a
minimal
example
of
such
a
test
runner
::
if
__name__
==
'__main__'
:
import
doctest
flags
=
doctest
.
REPORT_NDIFF
|
doctest
.
FAIL_FAST
if
len
(
sys
.
argv
)
>
1
:
name
=
sys
.
argv
[
1
]
if
name
in
globals
():
obj
=
globals
()[
name
]
else
:
obj
=
__test__
[
name
]
doctest
.
run_docstring_examples
(
obj
,
globals
(),
name
=
name
,
optionflags
=
flags
)
else
:
fail
,
total
=
doctest
.
testmod
(
optionflags
=
flags
)
print
(
"{} failures out of {} tests"
.
format
(
fail
,
total
))
..
rubric
::
Footnotes
..
rubric
::
Footnotes
..
[#]
Examples
containing
both
expected
output
and
an
exception
are
not
supported
.
..
[#]
Examples
containing
both
expected
output
and
an
exception
are
not
supported
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment