diff --git a/makefun/tests/test_issues.py b/makefun/tests/test_issues.py index a4a9486..39c8596 100644 --- a/makefun/tests/test_issues.py +++ b/makefun/tests/test_issues.py @@ -77,3 +77,28 @@ def __init__(self, *args, **kwargs): super(Bar, self).__init__(*args, **kwargs) b = Bar(2) + + +def test_issue_55(): + """Tests that no syntax error appears when no arguments are provided in the signature (name change scenario)""" + + # full name change including stack trace + + @with_signature('bar()') + def foo(): + return 'a' + + assert "bar at" in repr(foo) + assert foo.__name__ == 'bar' + assert foo() == 'a' + + # only metadata change + + @with_signature(None, func_name='bar') + def foo(): + return 'a' + + if sys.version_info >= (3, 0): + assert "foo at" in repr(foo) + assert foo.__name__ == 'bar' + assert foo() == 'a'