mirror of
https://github.com/python/cpython.git
synced 2026-01-20 14:20:27 +00:00
[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 620a5b9269)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
This commit is contained in:
parent
bfc57f70ac
commit
ea26c885fd
1 changed files with 3 additions and 8 deletions
|
|
@ -3448,16 +3448,11 @@ def _(item: int, arg: bytes) -> str:
|
|||
|
||||
def test_method_signatures(self):
|
||||
class A:
|
||||
def m(self, item, arg: int) -> str:
|
||||
return str(item)
|
||||
@classmethod
|
||||
def cm(cls, item, arg: int) -> str:
|
||||
return str(item)
|
||||
@functools.singledispatchmethod
|
||||
def func(self, item, arg: int) -> str:
|
||||
return str(item)
|
||||
@func.register
|
||||
def _(self, item, arg: bytes) -> str:
|
||||
def _(self, item: int, arg: bytes) -> str:
|
||||
return str(item)
|
||||
|
||||
@functools.singledispatchmethod
|
||||
|
|
@ -3466,7 +3461,7 @@ def cls_func(cls, item, arg: int) -> str:
|
|||
return str(arg)
|
||||
@func.register
|
||||
@classmethod
|
||||
def _(cls, item, arg: bytes) -> str:
|
||||
def _(cls, item: int, arg: bytes) -> str:
|
||||
return str(item)
|
||||
|
||||
@functools.singledispatchmethod
|
||||
|
|
@ -3475,7 +3470,7 @@ def static_func(item, arg: int) -> str:
|
|||
return str(arg)
|
||||
@func.register
|
||||
@staticmethod
|
||||
def _(item, arg: bytes) -> str:
|
||||
def _(item: int, arg: bytes) -> str:
|
||||
return str(item)
|
||||
|
||||
self.assertEqual(str(Signature.from_callable(A.func)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue