Call the given function with the given argument if func accepts one argument, otherwise calls func without arguments.
(func, arg)
| 721 | |
| 722 | |
| 723 | def _call_with_optional_argument(func, arg) -> None: |
| 724 | class="st">"""Call the given function with the given argument if func accepts one argument, otherwise |
| 725 | calls func without arguments.class="st">""" |
| 726 | arg_count = func.__code__.co_argcount |
| 727 | if inspect.ismethod(func): |
| 728 | arg_count -= 1 |
| 729 | if arg_count: |
| 730 | func(arg) |
| 731 | else: |
| 732 | func() |
| 733 | |
| 734 | |
| 735 | def _get_first_non_fixture_func(obj: object, names: Iterable[str]) -> object | None: |
no test coverage detected