Skip to content

Commit 3a1b52a

Browse files
author
Sylvain MARIE
committed
Added simple test corresponding to #55
1 parent 52e0885 commit 3a1b52a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

makefun/tests/test_issues.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,28 @@ def __init__(self, *args, **kwargs):
7777
super(Bar, self).__init__(*args, **kwargs)
7878

7979
b = Bar(2)
80+
81+
82+
def test_issue_55():
83+
"""Tests that no syntax error appears when no arguments are provided in the signature (name change scenario)"""
84+
85+
# full name change including stack trace
86+
87+
@with_signature('bar()')
88+
def foo():
89+
return 'a'
90+
91+
assert "bar at" in repr(foo)
92+
assert foo.__name__ == 'bar'
93+
assert foo() == 'a'
94+
95+
# only metadata change
96+
97+
@with_signature(None, func_name='bar')
98+
def foo():
99+
return 'a'
100+
101+
if sys.version_info >= (3, 0):
102+
assert "foo at" in repr(foo)
103+
assert foo.__name__ == 'bar'
104+
assert foo() == 'a'

0 commit comments

Comments
 (0)