Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7db42a1

Browse files
committed
add docstring test under-OO
1 parent92d1d16 commit7db42a1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

‎Lib/test/test_code.py‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,33 @@ def f():
868868
3* [(42,42,None,None)],
869869
)
870870

871+
@cpython_only
872+
deftest_docstring_under_o2(self):
873+
code=textwrap.dedent('''
874+
def has_docstring(x, y):
875+
"""This is a first-line doc string"""
876+
"""This is a second-line doc string"""
877+
a = x + y
878+
b = x - y
879+
return a, b
880+
881+
882+
def no_docstring(x):
883+
def g(y):
884+
return x + y
885+
return g
886+
887+
888+
async def async_func():
889+
"""asynf function doc string"""
890+
pass
891+
892+
893+
for func in [has_docstring, no_docstring(4), async_func]:
894+
assert(func.__doc__ is None)
895+
''')
896+
897+
rc,out,err=assert_python_ok('-OO','-c',code)
871898

872899
ifcheck_impl_detail(cpython=True)andctypesisnotNone:
873900
py=ctypes.pythonapi

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp