(self)
| 2909 | a2.t.foo |
| 2910 | |
| 2911 | def test_classmethod_register(self): |
| 2912 | class A: |
| 2913 | def __init__(self, arg): |
| 2914 | self.arg = arg |
| 2915 | |
| 2916 | @functools.singledispatchmethod |
| 2917 | @classmethod |
| 2918 | def t(cls, arg): |
| 2919 | return cls("base") |
| 2920 | @t.register(int) |
| 2921 | @classmethod |
| 2922 | def _(cls, arg): |
| 2923 | return cls("int") |
| 2924 | @t.register(str) |
| 2925 | @classmethod |
| 2926 | def _(cls, arg): |
| 2927 | return cls("str") |
| 2928 | |
| 2929 | self.assertEqual(A.t(0).arg, "int") |
| 2930 | self.assertEqual(A.t('').arg, "str") |
| 2931 | self.assertEqual(A.t(0.0).arg, "base") |
| 2932 | |
| 2933 | def test_callable_register(self): |
| 2934 | class A: |
nothing calls this directly
no test coverage detected