A runnable docstring test...

TODO: fix up the code! so this doesn't throw an assert error!
This commit is contained in:
rocky
2019-05-24 02:29:23 -04:00
parent 3c3e5c82fc
commit cccf33573b

View File

@@ -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()