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
d2f3857c
Kaydet (Commit)
d2f3857c
authored
Ock 30, 2011
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#10961: fix exception handling in new pydoc server code.
Patch by Ron Adam, reviewed by Eric Araujo.
üst
ce227e35
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
24 deletions
+24
-24
pydoc.py
Lib/pydoc.py
+0
-0
test_pydoc.py
Lib/test/test_pydoc.py
+21
-24
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/pydoc.py
Dosyayı görüntüle @
d2f3857c
This diff is collapsed.
Click to expand it.
Lib/test/test_pydoc.py
Dosyayı görüntüle @
d2f3857c
...
@@ -244,7 +244,7 @@ def get_html_title(text):
...
@@ -244,7 +244,7 @@ def get_html_title(text):
return
title
return
title
class
Py
D
ocDocTest
(
unittest
.
TestCase
):
class
Py
d
ocDocTest
(
unittest
.
TestCase
):
@unittest.skipIf
(
sys
.
flags
.
optimize
>=
2
,
@unittest.skipIf
(
sys
.
flags
.
optimize
>=
2
,
"Docstrings are omitted with -O2 and above"
)
"Docstrings are omitted with -O2 and above"
)
...
@@ -392,7 +392,7 @@ class TestDescriptions(unittest.TestCase):
...
@@ -392,7 +392,7 @@ class TestDescriptions(unittest.TestCase):
self
.
assertIn
(
expected
,
pydoc
.
render_doc
(
c
))
self
.
assertIn
(
expected
,
pydoc
.
render_doc
(
c
))
class
Py
D
ocServerTest
(
unittest
.
TestCase
):
class
Py
d
ocServerTest
(
unittest
.
TestCase
):
"""Tests for pydoc._start_server"""
"""Tests for pydoc._start_server"""
def
test_server
(
self
):
def
test_server
(
self
):
...
@@ -415,34 +415,31 @@ class PyDocServerTest(unittest.TestCase):
...
@@ -415,34 +415,31 @@ class PyDocServerTest(unittest.TestCase):
self
.
assertEqual
(
serverthread
.
error
,
None
)
self
.
assertEqual
(
serverthread
.
error
,
None
)
class
Py
D
ocUrlHandlerTest
(
unittest
.
TestCase
):
class
Py
d
ocUrlHandlerTest
(
unittest
.
TestCase
):
"""Tests for pydoc._url_handler"""
"""Tests for pydoc._url_handler"""
def
test_content_type_err
(
self
):
def
test_content_type_err
(
self
):
err
=
'Error: unknown content type '
f
=
pydoc
.
_url_handler
f
=
pydoc
.
_url_handler
result
=
f
(
""
,
""
)
self
.
assertRaises
(
TypeError
,
f
,
'A'
,
''
)
self
.
assertEqual
(
result
,
err
+
"''"
)
self
.
assertRaises
(
TypeError
,
f
,
'B'
,
'foobar'
)
result
=
f
(
""
,
"foobar"
)
self
.
assertEqual
(
result
,
err
+
"'foobar'"
)
def
test_url_requests
(
self
):
def
test_url_requests
(
self
):
# Test for the correct title in the html pages returned.
# Test for the correct title in the html pages returned.
# This tests the different parts of the URL handler without
# This tests the different parts of the URL handler without
# getting too picky about the exact html.
# getting too picky about the exact html.
requests
=
[
requests
=
[
(
""
,
"Py
thon
: Index of Modules"
),
(
""
,
"Py
doc
: Index of Modules"
),
(
"get?key="
,
"Py
thon
: Index of Modules"
),
(
"get?key="
,
"Py
doc
: Index of Modules"
),
(
"index"
,
"Py
thon
: Index of Modules"
),
(
"index"
,
"Py
doc
: Index of Modules"
),
(
"topics"
,
"Py
thon
: Topics"
),
(
"topics"
,
"Py
doc
: Topics"
),
(
"keywords"
,
"Py
thon
: Keywords"
),
(
"keywords"
,
"Py
doc
: Keywords"
),
(
"pydoc"
,
"Py
thon
: module pydoc"
),
(
"pydoc"
,
"Py
doc
: module pydoc"
),
(
"get?key=pydoc"
,
"Py
thon
: module pydoc"
),
(
"get?key=pydoc"
,
"Py
doc
: module pydoc"
),
(
"search?key=pydoc"
,
"Py
thon
: Search Results"
),
(
"search?key=pydoc"
,
"Py
doc
: Search Results"
),
(
"
def"
,
"Python
: KEYWORD def"
),
(
"
topic?key=def"
,
"Pydoc
: KEYWORD def"
),
(
"
STRINGS"
,
"Python
: TOPIC STRINGS"
),
(
"
topic?key=STRINGS"
,
"Pydoc
: TOPIC STRINGS"
),
(
"foobar"
,
"Py
thon: Erro
r"
),
(
"foobar"
,
"Py
doc: Error - fooba
r"
),
(
"getfile?key=foobar"
,
"Py
thon: Read Erro
r"
),
(
"getfile?key=foobar"
,
"Py
doc: Error - getfile?key=fooba
r"
),
]
]
for
url
,
title
in
requests
:
for
url
,
title
in
requests
:
...
@@ -451,7 +448,7 @@ class PyDocUrlHandlerTest(unittest.TestCase):
...
@@ -451,7 +448,7 @@ class PyDocUrlHandlerTest(unittest.TestCase):
self
.
assertEqual
(
result
,
title
)
self
.
assertEqual
(
result
,
title
)
path
=
string
.
__file__
path
=
string
.
__file__
title
=
"Py
thon
: getfile "
+
path
title
=
"Py
doc
: getfile "
+
path
url
=
"getfile?key="
+
path
url
=
"getfile?key="
+
path
text
=
pydoc
.
_url_handler
(
url
,
"text/html"
)
text
=
pydoc
.
_url_handler
(
url
,
"text/html"
)
result
=
get_html_title
(
text
)
result
=
get_html_title
(
text
)
...
@@ -459,10 +456,10 @@ class PyDocUrlHandlerTest(unittest.TestCase):
...
@@ -459,10 +456,10 @@ class PyDocUrlHandlerTest(unittest.TestCase):
def
test_main
():
def
test_main
():
test
.
support
.
run_unittest
(
Py
D
ocDocTest
,
test
.
support
.
run_unittest
(
Py
d
ocDocTest
,
TestDescriptions
,
TestDescriptions
,
Py
D
ocServerTest
,
Py
d
ocServerTest
,
Py
D
ocUrlHandlerTest
,
Py
d
ocUrlHandlerTest
,
)
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
Misc/NEWS
Dosyayı görüntüle @
d2f3857c
...
@@ -88,6 +88,9 @@ Library
...
@@ -88,6 +88,9 @@ Library
- Issue #9509: argparse now properly handles IOErrors raised by
- Issue #9509: argparse now properly handles IOErrors raised by
argparse.FileType.
argparse.FileType.
- Issue #10961: The new pydoc server now better handles exceptions raised
during request handling.
Build
Build
-----
-----
...
...
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