Skip to content

Commit 620a5b9

Browse files
authored
gh-127750: Fix annotations in singledispatchmethod signature tests (GH-143571)
These tests relied on a bug -- gh-84644, which is that singledispatch doesn't verify the annotation is on the "first" parameter.
1 parent 9633f95 commit 620a5b9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Lib/test/test_functools.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3450,16 +3450,11 @@ def _(item: int, arg: bytes) -> str:
34503450

34513451
def test_method_signatures(self):
34523452
class A:
3453-
def m(self, item, arg: int) -> str:
3454-
return str(item)
3455-
@classmethod
3456-
def cm(cls, item, arg: int) -> str:
3457-
return str(item)
34583453
@functools.singledispatchmethod
34593454
def func(self, item, arg: int) -> str:
34603455
return str(item)
34613456
@func.register
3462-
def _(self, item, arg: bytes) -> str:
3457+
def _(self, item: int, arg: bytes) -> str:
34633458
return str(item)
34643459

34653460
@functools.singledispatchmethod
@@ -3468,7 +3463,7 @@ def cls_func(cls, item, arg: int) -> str:
34683463
return str(arg)
34693464
@func.register
34703465
@classmethod
3471-
def _(cls, item, arg: bytes) -> str:
3466+
def _(cls, item: int, arg: bytes) -> str:
34723467
return str(item)
34733468

34743469
@functools.singledispatchmethod
@@ -3477,7 +3472,7 @@ def static_func(item, arg: int) -> str:
34773472
return str(arg)
34783473
@func.register
34793474
@staticmethod
3480-
def _(item, arg: bytes) -> str:
3475+
def _(item: int, arg: bytes) -> str:
34813476
return str(item)
34823477

34833478
self.assertEqual(str(Signature.from_callable(A.func)),

0 commit comments

Comments
 (0)