You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Adding tests for bytestring docstring
This commit is contained in:
BIN
test/bytecode_2.7/16_bytestring_docstring.pyc
Normal file
BIN
test/bytecode_2.7/16_bytestring_docstring.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.8/16_no_bytestring_docstring.pyc
Normal file
BIN
test/bytecode_3.8/16_no_bytestring_docstring.pyc
Normal file
Binary file not shown.
45
test/simple_source/stmts/16_bytestring_docstring.py
Normal file
45
test/simple_source/stmts/16_bytestring_docstring.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
"""Module docstring"""
|
||||||
|
class A:
|
||||||
|
b"""Got \xe7\xfe Bytes?"""
|
||||||
|
assert __doc__ == b"""Got \xe7\xfe Bytes?"""
|
||||||
|
|
||||||
|
def class_func(self):
|
||||||
|
b"""Got \xe7\xfe Bytes?"""
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
class B:
|
||||||
|
"""Got no Bytes?"""
|
||||||
|
assert __doc__ == """Got no Bytes?"""
|
||||||
|
|
||||||
|
def class_func(self):
|
||||||
|
"""Got no Bytes?"""
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
def single_func():
|
||||||
|
"""single docstring?"""
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
def single_byte_func():
|
||||||
|
b"""Got \xe7\xfe Bytes?"""
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
assert single_func.__doc__ == """single docstring?"""
|
||||||
|
single_func()
|
||||||
|
|
||||||
|
assert single_byte_func.__doc__ == b"""Got \xe7\xfe Bytes?"""
|
||||||
|
single_byte_func()
|
||||||
|
|
||||||
|
assert A.__doc__ == b"""Got \xe7\xfe Bytes?"""
|
||||||
|
assert A.class_func.__doc__ == b"""Got \xe7\xfe Bytes?"""
|
||||||
|
a = A()
|
||||||
|
assert a.class_func.__doc__ == b"""Got \xe7\xfe Bytes?"""
|
||||||
|
a.class_func()
|
||||||
|
|
||||||
|
assert B.__doc__ == """Got no Bytes?"""
|
||||||
|
assert B.class_func.__doc__ == """Got no Bytes?"""
|
||||||
|
b = B()
|
||||||
|
assert b.class_func.__doc__ == """Got no Bytes?"""
|
||||||
|
b.class_func()
|
||||||
|
|
45
test/simple_source/stmts/16_no_bytestring_docstring.py
Normal file
45
test/simple_source/stmts/16_no_bytestring_docstring.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
"""Module docstring"""
|
||||||
|
class A:
|
||||||
|
b"""Got \xe7\xfe Bytes?"""
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
def class_func(self):
|
||||||
|
b"""Got \xe7\xfe Bytes?"""
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
class B:
|
||||||
|
"""Got no Bytes?"""
|
||||||
|
assert __doc__ == """Got no Bytes?"""
|
||||||
|
|
||||||
|
def class_func(self):
|
||||||
|
"""Got no Bytes?"""
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
def single_func():
|
||||||
|
"""single docstring?"""
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
def single_byte_func():
|
||||||
|
b"""Got \xe7\xfe Bytes?"""
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
assert __doc__ == """Module docstring"""
|
||||||
|
|
||||||
|
assert single_func.__doc__ == """single docstring?"""
|
||||||
|
single_func()
|
||||||
|
|
||||||
|
assert single_byte_func.__doc__ is None
|
||||||
|
single_byte_func()
|
||||||
|
|
||||||
|
assert A.__doc__ is None
|
||||||
|
assert A.class_func.__doc__ is None
|
||||||
|
a = A()
|
||||||
|
assert a.class_func.__doc__ is None
|
||||||
|
a.class_func()
|
||||||
|
|
||||||
|
assert B.__doc__ == """Got no Bytes?"""
|
||||||
|
assert B.class_func.__doc__ == """Got no Bytes?"""
|
||||||
|
b = B()
|
||||||
|
assert b.class_func.__doc__ == """Got no Bytes?"""
|
||||||
|
b.class_func()
|
||||||
|
|
Reference in New Issue
Block a user