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
9d0add0c
Kaydet (Commit)
9d0add0c
authored
Ock 27, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17041: Fix testing when Python is configured with the
--without-doc-strings.
üst
6f02ea02
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
20 deletions
+54
-20
test_win32.py
Lib/ctypes/test/test_win32.py
+4
-1
test_build_ext.py
Lib/distutils/tests/test_build_ext.py
+3
-2
support.py
Lib/test/support.py
+10
-0
test_bytes.py
Lib/test/test_bytes.py
+1
-0
test_functools.py
Lib/test/test_functools.py
+1
-0
test_pydoc.py
Lib/test/test_pydoc.py
+32
-17
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/ctypes/test/test_win32.py
Dosyayı görüntüle @
9d0add0c
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
from
ctypes
import
*
from
ctypes
import
*
from
ctypes.test
import
is_resource_enabled
from
ctypes.test
import
is_resource_enabled
import
unittest
,
sys
import
unittest
,
sys
from
test
import
support
import
_ctypes_test
import
_ctypes_test
...
@@ -60,7 +61,9 @@ if sys.platform == "win32":
...
@@ -60,7 +61,9 @@ if sys.platform == "win32":
def
test_COMError
(
self
):
def
test_COMError
(
self
):
from
_ctypes
import
COMError
from
_ctypes
import
COMError
self
.
assertEqual
(
COMError
.
__doc__
,
"Raised when a COM method call failed."
)
if
support
.
HAVE_DOCSTRINGS
:
self
.
assertEqual
(
COMError
.
__doc__
,
"Raised when a COM method call failed."
)
ex
=
COMError
(
-
1
,
"text"
,
(
"details"
,))
ex
=
COMError
(
-
1
,
"text"
,
(
"details"
,))
self
.
assertEqual
(
ex
.
hresult
,
-
1
)
self
.
assertEqual
(
ex
.
hresult
,
-
1
)
...
...
Lib/distutils/tests/test_build_ext.py
Dosyayı görüntüle @
9d0add0c
...
@@ -73,8 +73,9 @@ class BuildExtTestCase(TempdirManager,
...
@@ -73,8 +73,9 @@ class BuildExtTestCase(TempdirManager,
self
.
assertEqual
(
xx
.
foo
(
2
,
5
),
7
)
self
.
assertEqual
(
xx
.
foo
(
2
,
5
),
7
)
self
.
assertEqual
(
xx
.
foo
(
13
,
15
),
28
)
self
.
assertEqual
(
xx
.
foo
(
13
,
15
),
28
)
self
.
assertEqual
(
xx
.
new
()
.
demo
(),
None
)
self
.
assertEqual
(
xx
.
new
()
.
demo
(),
None
)
doc
=
'This is a template module just for instruction.'
if
support
.
HAVE_DOCSTRINGS
:
self
.
assertEqual
(
xx
.
__doc__
,
doc
)
doc
=
'This is a template module just for instruction.'
self
.
assertEqual
(
xx
.
__doc__
,
doc
)
self
.
assertTrue
(
isinstance
(
xx
.
Null
(),
xx
.
Null
))
self
.
assertTrue
(
isinstance
(
xx
.
Null
(),
xx
.
Null
))
self
.
assertTrue
(
isinstance
(
xx
.
Str
(),
xx
.
Str
))
self
.
assertTrue
(
isinstance
(
xx
.
Str
(),
xx
.
Str
))
...
...
Lib/test/support.py
Dosyayı görüntüle @
9d0add0c
...
@@ -1477,6 +1477,16 @@ def run_unittest(*classes):
...
@@ -1477,6 +1477,16 @@ def run_unittest(*classes):
_filter_suite
(
suite
,
case_pred
)
_filter_suite
(
suite
,
case_pred
)
_run_suite
(
suite
)
_run_suite
(
suite
)
#=======================================================================
# Check for the presence of docstrings.
HAVE_DOCSTRINGS
=
(
check_impl_detail
(
cpython
=
False
)
or
sys
.
platform
==
'win32'
or
sysconfig
.
get_config_var
(
'WITH_DOC_STRINGS'
))
requires_docstrings
=
unittest
.
skipUnless
(
HAVE_DOCSTRINGS
,
"test requires docstrings"
)
#=======================================================================
#=======================================================================
# doctest driver.
# doctest driver.
...
...
Lib/test/test_bytes.py
Dosyayı görüntüle @
9d0add0c
...
@@ -986,6 +986,7 @@ class AssortedBytesTest(unittest.TestCase):
...
@@ -986,6 +986,7 @@ class AssortedBytesTest(unittest.TestCase):
self
.
assertEqual
(
bytes
(
b
"abc"
)
<
b
"ab"
,
False
)
self
.
assertEqual
(
bytes
(
b
"abc"
)
<
b
"ab"
,
False
)
self
.
assertEqual
(
bytes
(
b
"abc"
)
<=
b
"ab"
,
False
)
self
.
assertEqual
(
bytes
(
b
"abc"
)
<=
b
"ab"
,
False
)
@test.support.requires_docstrings
def
test_doc
(
self
):
def
test_doc
(
self
):
self
.
assertIsNotNone
(
bytearray
.
__doc__
)
self
.
assertIsNotNone
(
bytearray
.
__doc__
)
self
.
assertTrue
(
bytearray
.
__doc__
.
startswith
(
"bytearray("
),
bytearray
.
__doc__
)
self
.
assertTrue
(
bytearray
.
__doc__
.
startswith
(
"bytearray("
),
bytearray
.
__doc__
)
...
...
Lib/test/test_functools.py
Dosyayı görüntüle @
9d0add0c
...
@@ -287,6 +287,7 @@ class TestUpdateWrapper(unittest.TestCase):
...
@@ -287,6 +287,7 @@ class TestUpdateWrapper(unittest.TestCase):
with
self
.
assertRaises
(
AttributeError
):
with
self
.
assertRaises
(
AttributeError
):
functools
.
update_wrapper
(
wrapper
,
f
,
assign
,
update
)
functools
.
update_wrapper
(
wrapper
,
f
,
assign
,
update
)
@support.requires_docstrings
@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"
)
def
test_builtin_update
(
self
):
def
test_builtin_update
(
self
):
...
...
Lib/test/test_pydoc.py
Dosyayı görüntüle @
9d0add0c
...
@@ -30,6 +30,14 @@ except ImportError:
...
@@ -30,6 +30,14 @@ except ImportError:
if
hasattr
(
pydoc_mod
,
"__loader__"
):
if
hasattr
(
pydoc_mod
,
"__loader__"
):
del
pydoc_mod
.
__loader__
del
pydoc_mod
.
__loader__
if
test
.
support
.
HAVE_DOCSTRINGS
:
expected_data_docstrings
=
(
'dictionary for instance variables (if defined)'
,
'list of weak references to the object (if defined)'
,
)
*
2
else
:
expected_data_docstrings
=
(
''
,
''
,
''
,
''
)
expected_text_pattern
=
"""
expected_text_pattern
=
"""
NAME
NAME
test.pydoc_mod - This is a test module for test_pydoc
test.pydoc_mod - This is a test module for test_pydoc
...
@@ -50,20 +58,16 @@ CLASSES
...
@@ -50,20 +58,16 @@ CLASSES
| ----------------------------------------------------------------------
| ----------------------------------------------------------------------
| Data descriptors defined here:
| Data descriptors defined here:
|
\x20\x20
|
\x20\x20
| __dict__
| __dict__
%
s
| dictionary for instance variables (if defined)
|
\x20\x20
|
\x20\x20
| __weakref__
| __weakref__
%
s
| list of weak references to the object (if defined)
\x20\x20\x20\x20
\x20\x20\x20\x20
class B(builtins.object)
class B(builtins.object)
| Data descriptors defined here:
| Data descriptors defined here:
|
\x20\x20
|
\x20\x20
| __dict__
| __dict__
%
s
| dictionary for instance variables (if defined)
|
\x20\x20
|
\x20\x20
| __weakref__
| __weakref__
%
s
| list of weak references to the object (if defined)
|
\x20\x20
|
\x20\x20
| ----------------------------------------------------------------------
| ----------------------------------------------------------------------
| Data and other attributes defined here:
| Data and other attributes defined here:
...
@@ -95,6 +99,9 @@ FILE
...
@@ -95,6 +99,9 @@ FILE
%
s
%
s
"""
.
strip
()
"""
.
strip
()
expected_text_data_docstrings
=
tuple
(
'
\n
| '
+
s
if
s
else
''
for
s
in
expected_data_docstrings
)
expected_html_pattern
=
"""
expected_html_pattern
=
"""
<table width="100
%%
" cellspacing=0 cellpadding=2 border=0 summary="heading">
<table width="100
%%
" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<tr bgcolor="#7799ee">
...
@@ -134,10 +141,10 @@ expected_html_pattern = """
...
@@ -134,10 +141,10 @@ expected_html_pattern = """
<hr>
<hr>
Data descriptors defined here:<br>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>
dictionary for instance variables (if defined)
</tt></dd>
<dd><tt>
%
s
</tt></dd>
</dl>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>
list of weak references to the object (if defined)
</tt></dd>
<dd><tt>
%
s
</tt></dd>
</dl>
</dl>
</td></tr></table> <p>
</td></tr></table> <p>
<table width="100
%%
" cellspacing=0 cellpadding=2 border=0 summary="section">
<table width="100
%%
" cellspacing=0 cellpadding=2 border=0 summary="section">
...
@@ -148,10 +155,10 @@ Data descriptors defined here:<br>
...
@@ -148,10 +155,10 @@ Data descriptors defined here:<br>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100
%%
">Data descriptors defined here:<br>
<td width="100
%%
">Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>
dictionary for instance variables (if defined)
</tt></dd>
<dd><tt>
%
s
</tt></dd>
</dl>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>
list of weak references to the object (if defined)
</tt></dd>
<dd><tt>
%
s
</tt></dd>
</dl>
</dl>
<hr>
<hr>
Data and other attributes defined here:<br>
Data and other attributes defined here:<br>
...
@@ -193,6 +200,8 @@ war</tt></dd></dl>
...
@@ -193,6 +200,8 @@ war</tt></dd></dl>
<td width="100
%%
">Nobody</td></tr></table>
<td width="100
%%
">Nobody</td></tr></table>
"""
.
strip
()
# ' <- emacs turd
"""
.
strip
()
# ' <- emacs turd
expected_html_data_docstrings
=
tuple
(
s
.
replace
(
' '
,
' '
)
for
s
in
expected_data_docstrings
)
# output pattern for missing module
# output pattern for missing module
missing_pattern
=
"no Python documentation found for '
%
s'"
missing_pattern
=
"no Python documentation found for '
%
s'"
...
@@ -262,7 +271,9 @@ class PydocDocTest(unittest.TestCase):
...
@@ -262,7 +271,9 @@ class PydocDocTest(unittest.TestCase):
mod_url
=
nturl2path
.
pathname2url
(
mod_file
)
mod_url
=
nturl2path
.
pathname2url
(
mod_file
)
else
:
else
:
mod_url
=
mod_file
mod_url
=
mod_file
expected_html
=
expected_html_pattern
%
(
mod_url
,
mod_file
,
doc_loc
)
expected_html
=
expected_html_pattern
%
(
(
mod_url
,
mod_file
,
doc_loc
)
+
expected_html_data_docstrings
)
if
result
!=
expected_html
:
if
result
!=
expected_html
:
print_diffs
(
expected_html
,
result
)
print_diffs
(
expected_html
,
result
)
self
.
fail
(
"outputs are not equal, see diff above"
)
self
.
fail
(
"outputs are not equal, see diff above"
)
...
@@ -271,8 +282,10 @@ class PydocDocTest(unittest.TestCase):
...
@@ -271,8 +282,10 @@ class PydocDocTest(unittest.TestCase):
"Docstrings are omitted with -O2 and above"
)
"Docstrings are omitted with -O2 and above"
)
def
test_text_doc
(
self
):
def
test_text_doc
(
self
):
result
,
doc_loc
=
get_pydoc_text
(
pydoc_mod
)
result
,
doc_loc
=
get_pydoc_text
(
pydoc_mod
)
expected_text
=
expected_text_pattern
%
\
expected_text
=
expected_text_pattern
%
(
(
doc_loc
,
inspect
.
getabsfile
(
pydoc_mod
))
(
doc_loc
,)
+
expected_text_data_docstrings
+
(
inspect
.
getabsfile
(
pydoc_mod
),))
if
result
!=
expected_text
:
if
result
!=
expected_text
:
print_diffs
(
expected_text
,
result
)
print_diffs
(
expected_text
,
result
)
self
.
fail
(
"outputs are not equal, see diff above"
)
self
.
fail
(
"outputs are not equal, see diff above"
)
...
@@ -346,8 +359,10 @@ class PydocDocTest(unittest.TestCase):
...
@@ -346,8 +359,10 @@ class PydocDocTest(unittest.TestCase):
captured_output
(
'stderr'
)
as
err
:
captured_output
(
'stderr'
)
as
err
:
helper
.
help
(
module
)
helper
.
help
(
module
)
result
=
buf
.
getvalue
()
.
strip
()
result
=
buf
.
getvalue
()
.
strip
()
expected_text
=
expected_help_pattern
%
\
expected_text
=
expected_help_pattern
%
(
(
doc_loc
,
inspect
.
getabsfile
(
pydoc_mod
))
(
doc_loc
,)
+
expected_text_data_docstrings
+
(
inspect
.
getabsfile
(
pydoc_mod
),))
self
.
assertEqual
(
''
,
output
.
getvalue
())
self
.
assertEqual
(
''
,
output
.
getvalue
())
self
.
assertEqual
(
''
,
err
.
getvalue
())
self
.
assertEqual
(
''
,
err
.
getvalue
())
self
.
assertEqual
(
expected_text
,
result
)
self
.
assertEqual
(
expected_text
,
result
)
...
...
Misc/NEWS
Dosyayı görüntüle @
9d0add0c
...
@@ -811,6 +811,9 @@ Extension Modules
...
@@ -811,6 +811,9 @@ Extension Modules
Tests
Tests
-----
-----
- Issue #17041: Fix testing when Python is configured with the
--without-doc-strings.
- Issue #15539: Added regression tests for Tools/scripts/pindent.py.
- Issue #15539: Added regression tests for Tools/scripts/pindent.py.
- Issue #15324: Fix regrtest parsing of --fromfile, --match, and --randomize
- Issue #15324: Fix regrtest parsing of --fromfile, --match, and --randomize
...
...
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