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
4581cfa3
Kaydet (Commit)
4581cfa3
authored
Kas 22, 2002
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #486438: Make module argument to testmod optional.
üst
f86e8ef3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
libdoctest.tex
Doc/lib/libdoctest.tex
+5
-1
doctest.py
Lib/doctest.py
+12
-4
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/lib/libdoctest.tex
Dosyayı görüntüle @
4581cfa3
...
...
@@ -152,6 +152,10 @@ if __name__ == "__main__":
_
test()
\end{verbatim}
If you want to test the module as the main module, you don't need to
pass M to
\function
{
testmod
}
; in this case, it will test the current
module.
Then running the module as a script causes the examples in the docstrings
to get executed and verified:
...
...
@@ -392,7 +396,7 @@ definition of \function{_test()} is
\begin{verbatim}
def
_
test():
import doctest, sys
doctest.testmod(
sys.modules["
__
main
__
"]
)
doctest.testmod()
\end{verbatim}
\end{enumerate}
...
...
Lib/doctest.py
Dosyayı görüntüle @
4581cfa3
...
...
@@ -1044,12 +1044,13 @@ see its docs for details.
master
=
None
def
testmod
(
m
,
name
=
None
,
globs
=
None
,
verbose
=
None
,
isprivate
=
None
,
def
testmod
(
m
=
None
,
name
=
None
,
globs
=
None
,
verbose
=
None
,
isprivate
=
None
,
report
=
1
):
"""m, name=None, globs=None, verbose=None, isprivate=None, report=1
"""m
=None
, name=None, globs=None, verbose=None, isprivate=None, report=1
Test examples in docstrings in functions and classes reachable from
module m, starting with m.__doc__. Private names are skipped.
Test examples in docstrings in functions and classes reachable
from module m (or the current module if m is not supplied), starting
with m.__doc__. Private names are skipped.
Also test examples reachable from dict m.__test__ if it exists and is
not None. m.__dict__ maps names to functions, classes and strings;
...
...
@@ -1090,6 +1091,13 @@ def testmod(m, name=None, globs=None, verbose=None, isprivate=None,
global
master
if
m
is
None
:
import
sys
# DWA - m will still be None if this wasn't invoked from the command
# line, in which case the following TypeError is about as good an error
# as we should expect
m
=
sys
.
modules
.
get
(
'__main__'
)
if
not
_ismodule
(
m
):
raise
TypeError
(
"testmod: module required; "
+
`m`
)
if
name
is
None
:
...
...
Misc/NEWS
Dosyayı görüntüle @
4581cfa3
...
...
@@ -389,6 +389,9 @@ Extension modules
Library
-------
- doctest.testmod can now be called without argument, which means to
test the current module.
- When cancelling a server that implemented threading with a keyboard
interrupt, the server would shut down but not terminate (waiting on
client threads). A new member variable, daemon_threads, was added to
...
...
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