Skip to content

Commit ea1ecf6

Browse files
[3.13] gh-127750: Fix annotations in singledispatchmethod signature tests (GH-143571) (GH-143708)
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 18eeec4 commit ea1ecf6

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

31523152
def test_method_signatures(self):
31533153
class A:
3154-
def m(self, item, arg: int) -> str:
3155-
return str(item)
3156-
@classmethod
3157-
def cm(cls, item, arg: int) -> str:
3158-
return str(item)
31593154
@functools.singledispatchmethod
31603155
def func(self, item, arg: int) -> str:
31613156
return str(item)
31623157
@func.register
3163-
def _(self, item, arg: bytes) -> str:
3158+
def _(self, item: int, arg: bytes) -> str:
31643159
return str(item)
31653160

31663161
@functools.singledispatchmethod
@@ -3169,7 +3164,7 @@ def cls_func(cls, item, arg: int) -> str:
31693164
return str(arg)
31703165
@func.register
31713166
@classmethod
3172-
def _(cls, item, arg: bytes) -> str:
3167+
def _(cls, item: int, arg: bytes) -> str:
31733168
return str(item)
31743169

31753170
@functools.singledispatchmethod
@@ -3178,7 +3173,7 @@ def static_func(item, arg: int) -> str:
31783173
return str(arg)
31793174
@func.register
31803175
@staticmethod
3181-
def _(item, arg: bytes) -> str:
3176+
def _(item: int, arg: bytes) -> str:
31823177
return str(item)
31833178

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

0 commit comments

Comments
 (0)