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
a08e8ded
Kaydet (Commit)
a08e8ded
authored
Mar 31, 2009
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#5598: document DocFileSuite *args argument.
üst
bd9dd31a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
32 deletions
+34
-32
doctest.rst
Doc/library/doctest.rst
+34
-32
No files found.
Doc/library/doctest.rst
Dosyayı görüntüle @
a08e8ded
...
@@ -965,7 +965,7 @@ There are two main functions for creating :class:`unittest.TestSuite` instances
...
@@ -965,7 +965,7 @@ There are two main functions for creating :class:`unittest.TestSuite` instances
from
text
files
and
modules
with
doctests
:
from
text
files
and
modules
with
doctests
:
.. function:: DocFileSuite([module_relative][, package][, setUp][, tearDown][, globs][, optionflags][, parser][, encoding])
..
function
::
DocFileSuite
(
*
paths
,
[
module_relative
][,
package
][,
setUp
][,
tearDown
][,
globs
][,
optionflags
][,
parser
][,
encoding
])
Convert
doctest
tests
from
one
or
more
text
files
to
a
Convert
doctest
tests
from
one
or
more
text
files
to
a
:
class
:`
unittest
.
TestSuite
`.
:
class
:`
unittest
.
TestSuite
`.
...
@@ -983,45 +983,47 @@ from text files and modules with doctests:
...
@@ -983,45 +983,47 @@ from text files and modules with doctests:
Optional
argument
*
module_relative
*
specifies
how
the
filenames
in
*
paths
*
Optional
argument
*
module_relative
*
specifies
how
the
filenames
in
*
paths
*
should
be
interpreted
:
should
be
interpreted
:
* If *module_relative* is ``True`` (the default), then each filename specifies
*
If
*
module_relative
*
is
``
True
``
(
the
default
),
then
each
filename
in
an OS-independent module-relative path. By default, this path is relative to
*
paths
*
specifies
an
OS
-
independent
module
-
relative
path
.
By
default
,
this
the calling module's directory; but if the *package* argument is specified, then
path
is
relative
to
the
calling
module
's directory; but if the *package*
it is relative to that package. To ensure OS-independence, each filename should
argument is specified, then it is relative to that package. To ensure
use ``/`` characters to separate path segments, and may not be an absolute path
OS-independence, each filename should use ``/`` characters to separate path
(i.e., it may not begin with ``/``).
segments, and may not be an absolute path (i.e., it may not begin with
``/``).
* If *module_relative* is ``False``, then each filename specifies an OS-specific
path. The path may be absolute or relative; relative paths are resolved with
* If *module_relative* is ``False``, then each filename in *paths* specifies
respect to the current working directory.
an OS-specific path. The path may be absolute or relative; relative paths
are resolved with respect to the current working directory.
Optional argument *package* is a Python package or the name of a Python package
whose directory should be used as the base directory for module-relative
Optional argument *package* is a Python package or the name of a Python
filenames. If no package is specified, then the calling module's directory is
package whose directory should be used as the base directory for
used as the base directory for module-relative filenames. It is an error to
module-relative filenames in *paths*. If no package is specified, then the
specify *package* if *module_relative* is ``False``.
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
Optional argument *setUp* specifies a set-up function for the test suite. This
``
False
``.
is called before running the tests in each file. The *setUp* function will be
passed a :class:`DocTest` object. The setUp function can access the test
Optional
argument
*
setUp
*
specifies
a
set
-
up
function
for
the
test
suite
.
globals as the *globs* attribute of the test passed.
This
is
called
before
running
the
tests
in
each
file
.
The
*
setUp
*
function
Optional argument *tearDown* specifies a tear-down function for the test suite.
This is called after running the tests in each file. The *tearDown* function
will
be
passed
a
:
class
:`
DocTest
`
object
.
The
setUp
function
can
access
the
will
be
passed
a
:
class
:`
DocTest
`
object
.
The
setUp
function
can
access
the
test
globals
as
the
*
globs
*
attribute
of
the
test
passed
.
test
globals
as
the
*
globs
*
attribute
of
the
test
passed
.
Optional
argument
*
tearDown
*
specifies
a
tear
-
down
function
for
the
test
suite
.
This
is
called
after
running
the
tests
in
each
file
.
The
*
tearDown
*
function
will
be
passed
a
:
class
:`
DocTest
`
object
.
The
setUp
function
can
access
the
test
globals
as
the
*
globs
*
attribute
of
the
test
passed
.
Optional
argument
*
globs
*
is
a
dictionary
containing
the
initial
global
Optional
argument
*
globs
*
is
a
dictionary
containing
the
initial
global
variables
for
the
tests
.
A
new
copy
of
this
dictionary
is
created
for
each
variables
for
the
tests
.
A
new
copy
of
this
dictionary
is
created
for
each
test
.
By
default
,
*
globs
*
is
a
new
empty
dictionary
.
test
.
By
default
,
*
globs
*
is
a
new
empty
dictionary
.
Optional
argument
*
optionflags
*
specifies
the
default
doctest
options
for
the
Optional
argument
*
optionflags
*
specifies
the
default
doctest
options
for
the
tests
,
created
by
or
-
ing
together
individual
option
flags
.
See
section
tests
,
created
by
or
-
ing
together
individual
option
flags
.
See
section
:ref:`doctest-options`. See function :func:`set_unittest_reportflags` below
for
:
ref
:`
doctest
-
options
`.
See
function
:
func
:`
set_unittest_reportflags
`
below
a better way to set reporting options.
for
a
better
way
to
set
reporting
options
.
Optional argument *parser* specifies a :class:`DocTestParser` (or subclass)
that
Optional
argument
*
parser
*
specifies
a
:
class
:`
DocTestParser
`
(
or
subclass
)
should be used to extract tests from the files. It defaults to a normal parser
that
should
be
used
to
extract
tests
from
the
files
.
It
defaults
to
a
normal
(i.e., ``DocTestParser()``).
parser
(
i
.
e
.,
``
DocTestParser
()``).
Optional
argument
*
encoding
*
specifies
an
encoding
that
should
be
used
to
Optional
argument
*
encoding
*
specifies
an
encoding
that
should
be
used
to
convert
the
file
to
unicode
.
convert
the
file
to
unicode
.
...
@@ -1029,8 +1031,8 @@ from text files and modules with doctests:
...
@@ -1029,8 +1031,8 @@ from text files and modules with doctests:
..
versionadded
::
2.4
..
versionadded
::
2.4
..
versionchanged
::
2.5
..
versionchanged
::
2.5
The global ``__file__`` was added to the globals provided to doctests
loaded
The
global
``
__file__
``
was
added
to
the
globals
provided
to
doctests
from a text file using :func:`DocFileSuite`.
loaded
from
a
text
file
using
:
func
:`
DocFileSuite
`.
..
versionchanged
::
2.5
..
versionchanged
::
2.5
The
parameter
*
encoding
*
was
added
.
The
parameter
*
encoding
*
was
added
.
...
...
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