From cccf33573b430edda9a2bd0ccf816835b0245b3c Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 24 May 2019 02:29:23 -0400 Subject: [PATCH] A runnable docstring test... TODO: fix up the code! so this doesn't throw an assert error! --- test/simple_source/stmts/00_docstring.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/simple_source/stmts/00_docstring.py b/test/simple_source/stmts/00_docstring.py index 35870773..d8f2a077 100644 --- a/test/simple_source/stmts/00_docstring.py +++ b/test/simple_source/stmts/00_docstring.py @@ -1,4 +1,6 @@ # uncompyle2 bug was not escaping """ properly + +# RUNNABLE! r'''func placeholder - with ("""\nstring\n""")''' def foo(): r'''func placeholder - ' and with ("""\nstring\n""")''' @@ -20,3 +22,22 @@ def baz(): >>> t.rundict(m1.__dict__, 'rundict_test_pvt') # None are skipped. TestResults(failed=0, attempted=8) """ + assert __doc__ == r'''func placeholder - with ("""\nstring\n""")''' + assert foo.__doc__ == r'''func placeholder - ' and with ("""\nstring\n""")''' + assert bar.__doc__ == r"""func placeholder - ' and with ('''\nstring\n''') and \"\"\"\nstring\n\"\"\" """ + assert baz.__doc__ == \ + """ + ... '''>>> assert 1 == 1 + ... ''' + ... \""" + >>> exec test_data in m1.__dict__ + >>> exec test_data in m2.__dict__ + >>> m1.__dict__.update({"f2": m2._f, "g2": m2.g, "h2": m2.H}) + + Tests that objects outside m1 are excluded: + \""" + >>> t.rundict(m1.__dict__, 'rundict_test_pvt') # None are skipped. + TestResults(failed=0, attempted=8) + """ + +baz()