Skip to content

Commit ea26c88

Browse files
[3.14] gh-127750: Fix annotations in singledispatchmethod signature tests (GH-143571) (GH-143707)
These tests relied on a bug -- gh-84644, which is that singledispatch doesn't verify the annotation is on the "first" parameter. (cherry picked from commit 620a5b9) Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
1 parent bfc57f7 commit ea26c88

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
@@ -3448,16 +3448,11 @@ def _(item: int, arg: bytes) -> str:
34483448

34493449
def test_method_signatures(self):
34503450
class A:
3451-
def m(self, item, arg: int) -> str:
3452-
return str(item)
3453-
@classmethod
3454-
def cm(cls, item, arg: int) -> str:
3455-
return str(item)
34563451
@functools.singledispatchmethod
34573452
def func(self, item, arg: int) -> str:
34583453
return str(item)
34593454
@func.register
3460-
def _(self, item, arg: bytes) -> str:
3455+
def _(self, item: int, arg: bytes) -> str:
34613456
return str(item)
34623457

34633458
@functools.singledispatchmethod
@@ -3466,7 +3461,7 @@ def cls_func(cls, item, arg: int) -> str:
34663461
return str(arg)
34673462
@func.register
34683463
@classmethod
3469-
def _(cls, item, arg: bytes) -> str:
3464+
def _(cls, item: int, arg: bytes) -> str:
34703465
return str(item)
34713466

34723467
@functools.singledispatchmethod
@@ -3475,7 +3470,7 @@ def static_func(item, arg: int) -> str:
34753470
return str(arg)
34763471
@func.register
34773472
@staticmethod
3478-
def _(item, arg: bytes) -> str:
3473+
def _(item: int, arg: bytes) -> str:
34793474
return str(item)
34803475

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

0 commit comments

Comments
 (0)