MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_docstring_omitted

Method test_docstring_omitted

Lib/test/test_compile.py:978–1000  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

976
977 @support.cpython_only
978 def test_docstring_omitted(self):
979 # See gh-115347
980 src = textwrap.dedent("""
981 def f():
982 "docstring1"
983 def h():
984 "docstring2"
985 return 42
986
987 class C:
988 "docstring3"
989 pass
990
991 return h
992 """)
993 for opt in [-1, 0, 1, 2]:
994 for mode in ["exec", "single"]:
995 with self.subTest(opt=opt, mode=mode):
996 code = compile(src, "<test>", mode, optimize=opt)
997 output = io.StringIO()
998 with contextlib.redirect_stdout(output):
999 dis.dis(code)
1000 self.assertNotIn('NOP', output.getvalue())
1001
1002 @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: unable to find constant -0.0 in (0.0,)
1003 def test_dont_merge_constants(self):

Callers

nothing calls this directly

Calls 6

getvalueMethod · 0.95
dedentMethod · 0.80
subTestMethod · 0.80
disMethod · 0.80
assertNotInMethod · 0.80
compileFunction · 0.50

Tested by

no test coverage detected