Commit bd2bc06a authored by Stefan Behnel's avatar Stefan Behnel

move PEP 3155 qualname tests into separate test module

--HG--
rename : tests/run/cyfunction.pyx => tests/run/qualname.pyx
parent 935d9e70
......@@ -31,69 +31,6 @@ def test_name():
'foo'
"""
def test_qualname():
"""
>>> test_qualname.__qualname__
'test_qualname'
>>> test_qualname.__qualname__ = 123 #doctest:+ELLIPSIS
Traceback (most recent call last):
TypeError: __qualname__ must be set to a ... object
>>> test_qualname.__qualname__ = 'foo'
>>> test_qualname.__qualname__
'foo'
"""
def test_nested_qualname():
"""
>>> outer, lambda_func, XYZ = test_nested_qualname()
>>> outer().__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test'
>>> outer().test.__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test.test'
>>> outer()().test.__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test.test'
>>> outer()().test().__qualname__
'XYZinner'
>>> outer()().test().Inner.__qualname__
'XYZinner.Inner'
>>> outer()().test().Inner.inner.__qualname__
'XYZinner.Inner.inner'
>>> lambda_func.__qualname__
'test_nested_qualname.<locals>.<lambda>'
>>> XYZ.__qualname__
'XYZ'
>>> XYZ.Inner.__qualname__
'XYZ.Inner'
>>> XYZ.Inner.inner.__qualname__
'XYZ.Inner.inner'
"""
def outer():
class Test(object):
def test(self):
global XYZinner
class XYZinner:
class Inner:
def inner(self):
pass
return XYZinner
return Test
global XYZ
class XYZ(object):
class Inner(object):
def inner(self):
pass
return outer, lambda:None, XYZ
def test_doc():
"""
>>> del test_doc.__doc__
......
# cython: binding=True
# mode: run
# tag: cyfunction,qualname
def test_qualname():
"""
>>> test_qualname.__qualname__
'test_qualname'
>>> test_qualname.__qualname__ = 123 #doctest:+ELLIPSIS
Traceback (most recent call last):
TypeError: __qualname__ must be set to a ... object
>>> test_qualname.__qualname__ = 'foo'
>>> test_qualname.__qualname__
'foo'
"""
def test_nested_qualname():
"""
>>> outer, lambda_func, XYZ = test_nested_qualname()
>>> outer().__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test'
>>> outer().test.__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test.test'
>>> outer()().test.__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test.test'
>>> outer()().test().__qualname__
'XYZinner'
>>> outer()().test().Inner.__qualname__
'XYZinner.Inner'
>>> outer()().test().Inner.inner.__qualname__
'XYZinner.Inner.inner'
>>> lambda_func.__qualname__
'test_nested_qualname.<locals>.<lambda>'
>>> XYZ.__qualname__
'XYZ'
>>> XYZ.Inner.__qualname__
'XYZ.Inner'
>>> XYZ.Inner.inner.__qualname__
'XYZ.Inner.inner'
"""
def outer():
class Test(object):
def test(self):
global XYZinner
class XYZinner:
class Inner:
def inner(self):
pass
return XYZinner
return Test
global XYZ
class XYZ(object):
class Inner(object):
def inner(self):
pass
return outer, lambda:None, XYZ
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment