Пример #1
0
 def _log_args(self, positional, named):
     positional = [utils.prepr(arg) for arg in positional]
     named = [
         '%s=%s' % (utils.unic(name), utils.prepr(value))
         for name, value in named.items()
     ]
     return 'Arguments: [ %s ]' % ' | '.join(positional + named)
Пример #2
0
 def _verify(self, item, expected=None, **config):
     if not expected:
         expected = repr(item).lstrip('')
     assert_equal(prepr(item, **config), expected)
     if isinstance(item, (str, bytes)) and not config:
         assert_equal(prepr([item]), '[%s]' % expected)
         assert_equal(prepr((item,)), '(%s,)' % expected)
         assert_equal(prepr({item: item}), '{%s: %s}' % (expected, expected))
         assert_equal(prepr({item}), '{%s}' % expected)
Пример #3
0
 def _verify(self, item, expected=None, **config):
     if not expected:
         expected = repr(item).lstrip('u')
     assert_equal(prepr(item, **config), expected)
     if isinstance(item, (unicode, bytes)) and not config:
         assert_equal(prepr([item]), '[%s]' % expected)
         assert_equal(prepr((item,)), '(%s,)' % expected)
         assert_equal(prepr({item: item}), '{%s: %s}' % (expected, expected))
         assert_equal(prepr({item}), ('{%s}' if PY3 else 'set([%s])') % expected)
Пример #4
0
 def _validate_key(self, key):
     if isinstance(key, xmlrpclib.Binary):
         raise ValueError('Dictionary keys cannot be binary. Got %s.' %
                          prepr(key.data))
     if IRONPYTHON:
         try:
             key.encode('ASCII')
         except UnicodeError:
             raise ValueError('Dictionary keys cannot contain non-ASCII '
                              'characters on IronPython. Got %s.' %
                              prepr(key))
Пример #5
0
 def _verify(self, item, expected=None):
     if not expected:
         expected = repr(item).lstrip('u')
     assert_equal(prepr(item), expected)
     if isinstance(item, (unicode, bytes)):
         assert_equal(prepr([item]), '[%s]' % expected)
         assert_equal(prepr((item, )), '(%s,)' % expected)
         assert_equal(prepr({item: item}),
                      '{%s: %s}' % (expected, expected))
         assert_equal(prepr({item}),
                      ('{%s}' if PY3 else 'set([%s])') % expected)
 def assign(self, context, return_value):
     self.validate_assignment()
     context.trace(lambda: 'Return: %s' % prepr(return_value))
     resolver = ReturnValueResolver(self.assignment)
     for name, value in resolver.resolve(return_value):
         if not self._extended_assign(name, value, context.variables):
             value = self._normal_assign(name, value, context.variables)
         context.info(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)
     if self.arguments.kwargs:
         args.append('&{%s}' % self.arguments.kwargs)
     args = ['%s=%s' % (name, prepr(variables[name])) for name in args]
     return 'Arguments: [ %s ]' % ' | '.join(args)
Пример #8
0
 def assign(self, return_value):
     context = self._context
     context.trace(lambda: 'Return: %s' % prepr(return_value))
     resolver = ReturnValueResolver(self._assignment)
     for name, value in resolver.resolve(return_value):
         if not self._extended_assign(name, value, context.variables):
             value = self._normal_assign(name, value, context.variables)
         context.info(format_assign_message(name, value))
Пример #9
0
 def _log_args(self, variables):
     args = ['${%s}' % arg for arg in self.arguments.positional]
     if self.arguments.varargs:
         args.append('@{%s}' % self.arguments.varargs)
     if self.arguments.kwargs:
         args.append('&{%s}' % self.arguments.kwargs)
     args = ['%s=%s' % (name, prepr(variables[name])) for name in args]
     return 'Arguments: [ %s ]' % ' | '.join(args)
Пример #10
0
 def _check_deprecations(self, cells, path, line_number):
     for original in cells:
         normalized = ' '.join(original.split())
         if normalized != original:
             if len(normalized) != len(original):
                 msg = 'Collapsing consecutive whitespace'
             else:
                 msg = 'Converting whitespace characters to ASCII spaces'
             LOGGER.warn("%s during parsing is deprecated. Fix %s in file "
                         "'%s' on line %d." %
                         (msg, prepr(original), path, line_number))
         yield normalized
Пример #11
0
 def _check_deprecations(self, cells, path, line_number):
     for original in cells:
         normalized = self._normalize_whitespace(original)
         if normalized != original:
             if len(normalized) != len(original):
                 msg = 'Collapsing consecutive whitespace'
             else:
                 msg = 'Converting whitespace characters to ASCII spaces'
             LOGGER.warn("%s during parsing is deprecated. Fix %s in file "
                         "'%s' on line %d."
                         % (msg, prepr(original), path, line_number))
         yield normalized
Пример #12
0
 def _trace_log_args(self, positional, named):
     args = [prepr(arg) for arg in positional]
     args += ['%s=%s' % (unic(n), prepr(v)) for n, v in named]
     return 'Arguments: [ %s ]' % ' | '.join(args)
Пример #13
0
 def _format_trace_log_args_message(self, args, variables):
     args = ['%s=%s' % (name, prepr(variables[name])) for name in args]
     return 'Arguments: [ %s ]' % ' | '.join(args)
Пример #14
0
 def _log_args(self, positional, named):
     positional = [utils.prepr(arg) for arg in positional]
     named = ['%s=%s' % (utils.unic(name), utils.prepr(value))
              for name, value in named]
     return 'Arguments: [ %s ]' % ' | '.join(positional + named)
 def _format_trace_log_args_message(self, args, variables):
     args = ['%s=%s' % (name, prepr(variables[name])) for name in args]
     return 'Arguments: [ %s ]' % ' | '.join(args)
Пример #16
0
 def assign(self, context, return_value):
     context.trace(lambda: 'Return: %s' % prepr(return_value))
     for name, value in self._return_resolver.resolve(return_value):
         if not self._extended_assign(name, value, context.variables):
             value = self._normal_assign(name, value, context.variables)
         context.info(format_assign_message(name, value))
 def _trace_log_args(self, positional, named):
     args = [prepr(arg) for arg in positional]
     args += ['%s=%s' % (unic(n), prepr(v)) for n, v in named]
     return 'Arguments: [ %s ]' % ' | '.join(args)
Пример #18
0
 def _verify(self, item, expected=None):
     if not expected:
         expected = repr(item)
     assert_equals(prepr(item), expected)
Пример #19
0
 def _verify(self, item, expected=None):
     if not expected:
         expected = repr(item)
     elif IRONPYTHON and "b'" in expected:
         expected = expected.replace("b'", "'")
     assert_equals(prepr(item), expected)
Пример #20
0
 def test_recursive(self):
     x = [1, 2]
     x.append(x)
     match = re.match(r'\[1, 2. <Recursion on list with id=\d+>\]', prepr(x))
     assert_true(match is not None)
Пример #21
0
 def _verify(self, item, expected=None):
     if not expected:
         expected = repr(item)
     elif IRONPYTHON and "b'" in expected:
         expected = expected.replace("b'", "'")
     assert_equals(prepr(item), expected)
 def logger():
     args = [prepr(arg) for arg in positional]
     args += ['%s=%s' % (unic(n), prepr(v)) for n, v in named]
     return 'Arguments: [ %s ]' % ' | '.join(args)
Пример #23
0
 def test_recursive(self):
     x = [1, 2]
     x.append(x)
     match = re.match(r'\[1, 2. <Recursion on list with id=\d+>\]',
                      prepr(x))
     assert_true(match is not None)
Пример #24
0
 def _verify(self, item, expected=None):
     if not expected:
         expected = repr(item)
     assert_equals(prepr(item), expected)