(self)
| 3571 | '(item, arg: int) -> str') |
| 3572 | |
| 3573 | def test_method_signatures(self): |
| 3574 | class A: |
| 3575 | @functools.singledispatchmethod |
| 3576 | def func(self, item, arg: int) -> str: |
| 3577 | return str(item) |
| 3578 | @func.register |
| 3579 | def _(self, item: int, arg: bytes) -> str: |
| 3580 | return str(item) |
| 3581 | |
| 3582 | @functools.singledispatchmethod |
| 3583 | @classmethod |
| 3584 | def cls_func(cls, item, arg: int) -> str: |
| 3585 | return str(arg) |
| 3586 | @func.register |
| 3587 | @classmethod |
| 3588 | def _(cls, item: int, arg: bytes) -> str: |
| 3589 | return str(item) |
| 3590 | |
| 3591 | @functools.singledispatchmethod |
| 3592 | @staticmethod |
| 3593 | def static_func(item, arg: int) -> str: |
| 3594 | return str(arg) |
| 3595 | @func.register |
| 3596 | @staticmethod |
| 3597 | def _(item: int, arg: bytes) -> str: |
| 3598 | return str(item) |
| 3599 | |
| 3600 | self.assertEqual(str(Signature.from_callable(A.func)), |
| 3601 | '(self, item, arg: int) -> str') |
| 3602 | self.assertEqual(str(Signature.from_callable(A().func)), |
| 3603 | '(self, item, arg: int) -> str') |
| 3604 | self.assertEqual(str(Signature.from_callable(A.cls_func)), |
| 3605 | '(cls, item, arg: int) -> str') |
| 3606 | self.assertEqual(str(Signature.from_callable(A.static_func)), |
| 3607 | '(item, arg: int) -> str') |
| 3608 | |
| 3609 | def test_method_non_descriptor(self): |
| 3610 | class Callable: |
nothing calls this directly
no test coverage detected