Skip to content

Commit 2be8358

Browse files
vsedmikclaude
authored andcommitted
Fix test_identical_args to ignore type annotations in signature comparison (#1421)
requests 2.33.0 added type annotations to its public functions, causing inspect.signature() comparisons to fail since nailgun's wrappers don't replicate those annotations. Strip annotations from both sides before comparing so the test validates parameter names/kinds/defaults only. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit cbfb67f)
1 parent 759d59e commit 2be8358

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/test_client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,15 @@ def test_identical_args(self):
130130
signature as ``requests.delete``.
131131
132132
"""
133+
134+
def _strip_annotations(sig):
135+
params = [
136+
p.replace(annotation=inspect.Parameter.empty) for p in sig.parameters.values()
137+
]
138+
return sig.replace(parameters=params, return_annotation=inspect.Parameter.empty)
139+
133140
for meth in ('delete', 'get', 'head', 'patch', 'post', 'put'):
134141
self.assertEqual(
135-
inspect.signature(getattr(client, meth)),
136-
inspect.signature(getattr(requests, meth)),
142+
_strip_annotations(inspect.signature(getattr(client, meth))),
143+
_strip_annotations(inspect.signature(getattr(requests, meth))),
137144
)

0 commit comments

Comments
 (0)