def test_old_style_task_with_default_args(self): def task_old_style(arg1, arg2, arg3=None, arg4='yes'): '''Docstring''' details = get_task_details(task_old_style) eq_("Docstring\n" "Arguments: arg1, arg2, arg3=None, arg4='yes'", details)
def test_old_style_task_without_args(self): def task_old_style(): '''Docstring''' details = get_task_details(task_old_style) eq_("Docstring\n" "Arguments: ", details)
def __details__(self): with utils.patch( six.get_method_function(self.tasks.service.destroy), '__doc__', self.__doc__ + (self.tasks.service.destroy.__doc__ or ''), ): return get_task_details(self.tasks.service.destroy)
def test_old_style_task_without_args(self): """ __details__() should print docstr for old style task methods without args """ def task_old_style(): '''Docstring''' details = get_task_details(task_old_style) eq_("Docstring\n" "Arguments: ", details)
def test_old_style_task_with_default_args(self): """ __details__() should print docstr for old style task methods with default args """ def task_old_style(arg1, arg2, arg3=None, arg4='yes'): '''Docstring''' details = get_task_details(task_old_style) eq_("Docstring\n" "Arguments: arg1, arg2, arg3=None, arg4='yes'", details)
def test_old_style_task_without_args(self): """ __details__() should print docstr for old style task methods without args """ def task_old_style(): """Docstring""" details = get_task_details(task_old_style) eq_("Docstring\n" "Arguments: ", details)
def display_command(name): """ Print command function's docstring, then exit. Invoked with -d/--display. """ # Sanity check command = crawl(name, state.commands) if command is None: msg = "Task '%s' does not appear to exist. Valid task names:\n%s" abort(msg % (name, "\n".join(_normal_list(False)))) # Print out nicely presented docstring if found if hasattr(command, '__details__'): task_details = command.__details__() else: task_details = get_task_details(command) if task_details: print("Displaying detailed information for task '%s':" % name) print('') print(indent(task_details, strip=True)) print('') # Or print notice if not else: print("No detailed information available for task '%s':" % name) sys.exit(0)
def _details(): return get_task_details(wrapped)
def __details__(self): doc = self.__doc__ + (self.callback.__doc__ or '') with utils.patch(self.callback, '__doc__', doc): return get_task_details(self.callback)