File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -3274,6 +3274,22 @@ def _(arg, extra: int):
32743274 "Use either `@register(some_class)` or add a type annotation "
32753275 f"to parameter 'arg' of your callable." )
32763276
3277+ with self .assertRaises (TypeError ) as exc :
3278+ # See GH-84644.
3279+
3280+ @functools .singledispatch
3281+ def func (arg ):...
3282+
3283+ @func .register
3284+ def _int (arg ) -> int :...
3285+
3286+ self .assertStartsWith (str (exc .exception ), msg_prefix +
3287+ "<function TestSingleDispatch.test_invalid_registrations.<locals>._"
3288+ )
3289+ self .assertEndsWith (str (exc .exception ),
3290+ "Use either `@register(some_class)` or add a type annotation "
3291+ f"to parameter 'arg' of your callable." )
3292+
32773293 with self .assertRaises (TypeError ) as exc :
32783294 @i .register
32793295 def _ (arg : typing .Iterable [str ]):
You can’t perform that action at this time.
0 commit comments