Skip to content

Commit 57965a9

Browse files
committed
Merge GH-130827 test into test_method_type_ann_register
1 parent e4fb514 commit 57965a9

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

Lib/test/test_functools.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2933,9 +2933,10 @@ def t(self, arg):
29332933
def _(self, arg: int):
29342934
return "int"
29352935
@t.register
2936-
def _(self, arg: str):
2936+
def _(self, /, arg: str):
29372937
return "str"
2938-
def _(self, arg: bytes):
2938+
# See GH-130827.
2939+
def _(self: typing.Self, arg: bytes):
29392940
return "bytes"
29402941
@t.register
29412942
@functools.wraps(_)
@@ -3623,21 +3624,6 @@ def _(self, arg):
36233624
self.assertEqual(a.v(0), ('special', 0))
36243625
self.assertEqual(a.v(2.5), ('general', 2.5))
36253626

3626-
def test_method_self_annotation(self):
3627-
"""See GH-130827."""
3628-
class A:
3629-
@functools.singledispatchmethod
3630-
def u(self: typing.Self, arg: int | str) -> int | str:
3631-
return None
3632-
3633-
@u.register
3634-
def _(self: typing.Self, arg: int) -> int:
3635-
return arg
3636-
3637-
a = A()
3638-
self.assertEqual(a.u(42), 42)
3639-
self.assertEqual(a.u("hello"), None)
3640-
36413627

36423628
class CachedCostItem:
36433629
_cost = 1

0 commit comments

Comments
 (0)