def _tracelog_args(self, logger, posargs, namedargs={}): if self._logger_not_available_during_library_init(logger): return args = [ utils.safe_repr(a) for a in posargs ] \ + [ '%s=%s' % (utils.unic(a), utils.safe_repr(namedargs[a])) for a in namedargs ] logger.trace('Arguments: [ %s ]' % ' | '.join(args))
def _log_args(self, positional, named): positional = [utils.safe_repr(arg) for arg in positional] named = [ '%s=%s' % (utils.unic(name), utils.safe_repr(value)) for name, value in named.items() ] return 'Arguments: [ %s ]' % ' | '.join(positional + named)
def _tracelog_args(self, logger, posargs, namedargs={}): if self._logger_not_available_during_library_init(logger): return args = [utils.safe_repr(a) for a in posargs] \ + ['%s=%s' % (utils.unic(a), utils.safe_repr(namedargs[a])) for a in namedargs] logger.trace('Arguments: [ %s ]' % ' | '.join(args))
def _get_tracelog_arg_message(self, positional, named): args = [utils.safe_repr(arg) for arg in positional] if named: args += [ '%s=%s' % (utils.unic(name), utils.safe_repr(value)) for name, value in named.items() ] return 'Arguments: [ %s ]' % ' | '.join(args)
def assign(self, context, return_value): context.trace('Return: %s' % utils.safe_repr(return_value)) if not (self.scalar_vars or self.list_var): return for name, value in self._get_vars_to_set(return_value): context.get_current_vars()[name] = value context.output.info(utils.format_assign_message(name, value))
def _log_args(self, variables): args = ['${%s}' % arg for arg in self.arguments.positional] if self.arguments.varargs: args.append('@{%s}' % self.arguments.varargs) args = ['%s=%s' % (name, utils.safe_repr(variables[name])) for name in args] return 'Arguments: [ %s ]' % ' | '.join(args)
def _get_tracelog_arg_message(self, variables): names = self.names + ([self.varargs] if self.varargs else []) args = [ '%s=%s' % (name, utils.safe_repr(variables[name])) for name in names ] return 'Arguments: [ %s ]' % ' | '.join(args)
def _log_args(self, variables): args = ['${%s}' % arg for arg in self.arguments.positional] if self.arguments.varargs: args.append('@{%s}' % self.arguments.varargs) args = [ '%s=%s' % (name, utils.safe_repr(variables[name])) for name in args ] return 'Arguments: [ %s ]' % ' | '.join(args)
def _get_tracelog_arg_message(self, variables): names = self.names + ([self.varargs] if self.varargs else []) args = ['%s=%s' % (name, utils.safe_repr(variables[name])) for name in names] return 'Arguments: [ %s ]' % ' | '.join(args)
def _log_args(self, variables): args = ["${%s}" % arg for arg in self.arguments.positional] if self.arguments.varargs: args.append("@{%s}" % self.arguments.varargs) args = ["%s=%s" % (name, utils.safe_repr(variables[name])) for name in args] return "Arguments: [ %s ]" % " | ".join(args)
def test_failure_in_repr(self): assert_equals(safe_repr(ReprFails()), _unrepresentable_msg % ('ReprFails', 'Failure in __repr__'))
def test_unicode_items_in_list_repr_have_u_prefix(self): assert_equals(safe_repr([]), '[]') assert_equals(safe_repr([u'foo']), "[u'foo']") assert_equals(safe_repr([u'a', 1, u"'"]), "[u'a', 1, u\"'\"]")
def test_failure_in_repr(self): assert_equals( safe_repr(ReprFails()), _unrepresentable_msg % ('ReprFails', 'Failure in __repr__'))
def assign(self, context, return_value): context.trace(lambda: 'Return: %s' % safe_repr(return_value)) if self.scalar_vars or self.list_var: self._assign(context, ReturnValue(self.scalar_vars, self.list_var, return_value))
def test_repr_of_unicode_has_u_prefix(self): assert_equals(safe_repr(u'foo'), "u'foo'") assert_equals(safe_repr(u"f'o'o"), "u\"f'o'o\"")
def _get_arguments_as_string(self, variables): args = [] for name in self.names + ([self.varargs] if self.varargs else []): args.append('%s=%s' % (name, utils.safe_repr(variables[name]))) return ' | '.join(args)
def _get_tracelog_arg_message(self, positional, named): args = [utils.safe_repr(arg) for arg in positional] if named: args += ['%s=%s' % (utils.unic(name), utils.safe_repr(value)) for name, value in named.items()] return 'Arguments: [ %s ]' % ' | '.join(args)
def assign(self, context, return_value): context.trace(lambda: 'Return: %s' % safe_repr(return_value)) if self.scalar_vars or self.list_var: self._assign( context, ReturnValue(self.scalar_vars, self.list_var, return_value))
def test_failure_in_repr(self): assert_equals(safe_repr(ReprFails()), UNREPR % ('ReprFails', 'Failure in __repr__'))
def _log_args(self, positional, named): positional = [utils.safe_repr(arg) for arg in positional] named = ["%s=%s" % (utils.unic(name), utils.safe_repr(value)) for name, value in named.items()] return "Arguments: [ %s ]" % " | ".join(positional + named)