File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -284,9 +284,13 @@ def format_methods(f):
284284 This calls `list_methods`, which see.
285285 """
286286 function , _ = getfunc (f )
287- methods_str = [f" { _format_method (x )} " for x in list_methods (f )]
288- methods = "\n " .join (methods_str )
289- return f"Multimethods for @{ isgeneric (f )} { repr (function .__qualname__ )} :\n { methods } "
287+ multimethods = list_methods (f )
288+ if multimethods :
289+ methods_list = [f" { _format_method (x )} " for x in multimethods ]
290+ methods_str = "\n " .join (methods_list )
291+ else : # pragma: no cover, in practice should always have one method.
292+ methods_str = " <no multimethods registered>"
293+ return f"Multimethods for @{ isgeneric (f )} { repr (function .__qualname__ )} :\n { methods_str } "
290294
291295def list_methods (f ):
292296 """Return a list of the multimethods currently registered to `f`.
You can’t perform that action at this time.
0 commit comments