Loading ...
Sorry, an error occurred while loading the content.

71402Re: [PATCH] (9/7) Consistency and refactoring

Expand Messages
  • ZyX
    Jun 19 9:12 PM
    • 0 Attachment
      Wrong patch. Correct one:

      # HG changeset patch
      # User ZyX <kp-pav@...>
      # Date 1371441247 -14400
      # Mon Jun 17 07:54:07 2013 +0400
      # Branch python-fixes
      # Node ID 42e166b5c6ff07cd7810780b1d3704b8ce61bac0
      # Parent 4a00cd941a883917f6d740f9f06aca7baadcb45e
      Add NUMBER_UNSIGNED to WindowSetattr(, "width"|"height")
      And more tests

      Note: in ee('import failing') it was expected to raise NotImplementedError, but
      actually raises ImportError

      diff --git a/src/if_py_both.h b/src/if_py_both.h
      --- a/src/if_py_both.h
      +++ b/src/if_py_both.h
      @@ -3357,7 +3357,7 @@
      long height;
      win_T *savewin;

      - if (NumberToLong(valObject, &height, NUMBER_INT))
      + if (NumberToLong(valObject, &height, NUMBER_INT|NUMBER_UNSIGNED))
      return -1;

      #ifdef FEAT_GUI
      @@ -3380,7 +3380,7 @@
      long width;
      win_T *savewin;

      - if (NumberToLong(valObject, &width, NUMBER_INT))
      + if (NumberToLong(valObject, &width, NUMBER_INT|NUMBER_UNSIGNED))
      return -1;

      #ifdef FEAT_GUI
      diff --git a/src/testdir/pythonx/failing.py b/src/testdir/pythonx/failing.py
      new file mode 100644
      --- /dev/null
      +++ b/src/testdir/pythonx/failing.py
      @@ -0,0 +1,1 @@
      +raise NotImplementedError
      diff --git a/src/testdir/pythonx/failing_import.py b/src/testdir/pythonx/failing_import.py
      new file mode 100644
      --- /dev/null
      +++ b/src/testdir/pythonx/failing_import.py
      @@ -0,0 +1,1 @@
      +raise ImportError
      diff --git a/src/testdir/pythonx/topmodule/__init__.py b/src/testdir/pythonx/topmodule/__init__.py
      new file mode 100644
      diff --git a/src/testdir/pythonx/topmodule/submodule/__init__.py b/src/testdir/pythonx/topmodule/submodule/__init__.py
      new file mode 100644
      diff --git a/src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py b/src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py
      new file mode 100644
      diff --git a/src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py b/src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py
      new file mode 100644
      diff --git a/src/testdir/test86.in b/src/testdir/test86.in
      --- a/src/testdir/test86.in
      +++ b/src/testdir/test86.in
      @@ -342,9 +342,9 @@
      EOF
      :py sys.settrace(traceit)
      :py trace_main()
      +:py sys.settrace(None)
      :py del traceit
      :py del trace_main
      -:py sys.settrace(None)
      :$put =string(l)
      :"
      :" Slice
      @@ -942,6 +942,7 @@
      '{u"": 1}', # Same, but with unicode object
      'FailingMapping()', #
      'FailingMappingKey()', #
      + 'FailingNumber()', #
      ))

      def convertfrompymapping_test(expr):
      @@ -956,6 +957,15 @@
      'FailingIterNext()',
      ))

      +def number_test(expr, natural=False, unsigned=False):
      + if natural:
      + unsigned = True
      + return subexpr_test(expr, 'NumberToLong', (
      + '[]',
      + 'None',
      + ) + (unsigned and ('-1',) or ())
      + + (natural and ('0',) or ()))
      +
      class FailingTrue(object):
      def __nonzero__(self):
      raise NotImplementedError
      @@ -992,30 +1002,59 @@
      else:
      return super(FailingList, self).__getitem__(idx)

      +class NoArgsCall(object):
      + def __call__(self):
      + pass
      +
      +class FailingCall(object):
      + def __call__(self, path):
      + raise NotImplementedError
      +
      +class FailingNumber(object):
      + def __int__(self):
      + raise NotImplementedError
      +
      cb.append("> Output")
      cb.append(">> OutputSetattr")
      ee('del sys.stdout.softspace')
      -ee('sys.stdout.softspace = []')
      +number_test('sys.stdout.softspace = %s', unsigned=True)
      +number_test('sys.stderr.softspace = %s', unsigned=True)
      ee('sys.stdout.attr = None')
      cb.append(">> OutputWrite")
      ee('sys.stdout.write(None)')
      cb.append(">> OutputWriteLines")
      ee('sys.stdout.writelines(None)')
      ee('sys.stdout.writelines([1])')
      -#iter_test('sys.stdout.writelines(%s)')
      +iter_test('sys.stdout.writelines(%s)')
      cb.append("> VimCommand")
      -ee('vim.command(1)')
      +stringtochars_test('vim.command(%s)')
      +ee('vim.command("", 2)')
      #! Not checked: vim->python exceptions translating: checked later
      cb.append("> VimToPython")
      #! Not checked: everything: needs errors in internal python functions
      cb.append("> VimEval")
      -ee('vim.eval(1)')
      +stringtochars_test('vim.eval(%s)')
      +ee('vim.eval("", FailingTrue())')
      #! Not checked: everything: needs errors in internal python functions
      cb.append("> VimEvalPy")
      -ee('vim.bindeval(1)')
      +stringtochars_test('vim.bindeval(%s)')
      +ee('vim.eval("", 2)')
      #! Not checked: vim->python exceptions translating: checked later
      cb.append("> VimStrwidth")
      -ee('vim.strwidth(1)')
      +stringtochars_test('vim.strwidth(%s)')
      +cb.append("> VimForeachRTP")
      +ee('vim.foreach_rtp(None)')
      +ee('vim.foreach_rtp(NoArgsCall())')
      +ee('vim.foreach_rtp(FailingCall())')
      +ee('vim.foreach_rtp(int, 2)')
      +cb.append('> import')
      +old_rtp = vim.options['rtp']
      +vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
      +ee('import xxx_no_such_module_xxx')
      +ee('import failing_import')
      +ee('import failing')
      +vim.options['rtp'] = old_rtp
      +del old_rtp
      cb.append("> Dictionary")
      cb.append(">> DictionaryConstructor")
      ee('vim.Dictionary("abcI")')
      @@ -1043,7 +1082,7 @@
      cb.append(">>> iter")
      ee('d.update(FailingMapping())')
      ee('d.update([FailingIterNext()])')
      -#iter_test('d.update(%s)')
      +iter_test('d.update(%s)')
      convertfrompyobject_test('d.update(%s)')
      stringtochars_test('d.update(((%s, 0),))')
      convertfrompyobject_test('d.update((("a", %s),))')
      @@ -1055,7 +1094,7 @@
      cb.append(">> ListConstructor")
      ee('vim.List(1, 2)')
      ee('vim.List(a=1)')
      -#iter_test('vim.List(%s)')
      +iter_test('vim.List(%s)')
      convertfrompyobject_test('vim.List([%s])')
      cb.append(">> ListItem")
      ee('l[1000]')
      @@ -1064,10 +1103,10 @@
      ee('l[1000] = 3')
      cb.append(">> ListAssSlice")
      ee('ll[1:100] = "abcJ"')
      -#iter_test('l[:] = %s')
      +iter_test('l[:] = %s')
      convertfrompyobject_test('l[:] = [%s]')
      cb.append(">> ListConcatInPlace")
      -#iter_test('l.extend(%s)')
      +iter_test('l.extend(%s)')
      convertfrompyobject_test('l.extend([%s])')
      cb.append(">> ListSetattr")
      ee('del l.locked')
      @@ -1094,14 +1133,15 @@
      ee('vim.current.window.buffer = 0')
      ee('vim.current.window.cursor = (100000000, 100000000)')
      ee('vim.current.window.cursor = True')
      -ee('vim.current.window.height = "abcK"')
      -ee('vim.current.window.width = "abcL"')
      +number_test('vim.current.window.height = %s', unsigned=True)
      +number_test('vim.current.window.width = %s', unsigned=True)
      ee('vim.current.window.xxxxxx = True')
      cb.append("> WinList")
      cb.append(">> WinListItem")
      ee('vim.windows[1000]')
      cb.append("> Buffer")
      cb.append(">> StringToLine (indirect)")
      +ee('vim.current.buffer[0] = u"\\na"')
      ee('vim.current.buffer[0] = "\\na"')
      cb.append(">> SetBufferLine (indirect)")
      ee('vim.current.buffer[0] = True')
      @@ -1129,8 +1169,8 @@
      ee('vim.current.buffer.range(1, 2, 3)')
      cb.append("> BufMap")
      cb.append(">> BufMapItem")
      -ee('vim.buffers[None]')
      ee('vim.buffers[100000000]')
      +number_test('vim.buffers[%s]', natural=True)
      cb.append("> Current")
      cb.append(">> CurrentGetattr")
      ee('vim.current.xxx')
      @@ -1154,12 +1194,16 @@
      del convertfrompyobject_test
      del convertfrompymapping_test
      del iter_test
      +del number_test
      del FailingTrue
      del FailingIter
      del FailingIterNext
      del FailingMapping
      del FailingMappingKey
      del FailingList
      +del NoArgsCall
      +del FailingCall
      +del FailingNumber
      EOF
      :delfunction F
      :"
      @@ -1168,6 +1212,16 @@
      sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
      sys.path.append(os.path.join(os.getcwd(), 'python_after'))
      vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
      +l = []
      +def callback(path):
      + l.append(path[-len('/testdir'):])
      +vim.foreach_rtp(callback)
      +cb.append(repr(l))
      +del l
      +def callback(path):
      + return path[-len('/testdir'):]
      +cb.append(repr(vim.foreach_rtp(callback)))
      +del callback
      from module import dir as d
      from modulex import ddir
      cb.append(d + ',' + ddir)
      @@ -1175,10 +1229,19 @@
      cb.append(before.dir)
      import after
      cb.append(after.dir)
      +import topmodule as tm
      +import topmodule.submodule as tms
      +import topmodule.submodule.subsubmodule.subsubsubmodule as tmsss
      +cb.append(tm.__file__.replace('.pyc', '.py')[-len('modulex/topmodule/__init__.py'):])
      +cb.append(tms.__file__.replace('.pyc', '.py')[-len('modulex/topmodule/submodule/__init__.py'):])
      +cb.append(tmsss.__file__.replace('.pyc', '.py')[-len('modulex/topmodule/submodule/subsubmodule/subsubsubmodule.py'):])
      del before
      del after
      del d
      del ddir
      +del tm
      +del tms
      +del tmsss
      EOF
      :"
      :" Test exceptions
      diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok
      --- a/src/testdir/test86.ok
      +++ b/src/testdir/test86.ok
      @@ -441,22 +441,63 @@
      > Output
      >> OutputSetattr
      del sys.stdout.softspace:AttributeError:("can't delete OutputObject attributes",)
      +>>> Testing NumberToLong using sys.stdout.softspace = %s
      sys.stdout.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
      +sys.stdout.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
      +sys.stdout.softspace = -1:ValueError:('number must be greater or equal to zero',)
      +<<< Finished
      +>>> Testing NumberToLong using sys.stderr.softspace = %s
      +sys.stderr.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
      +sys.stderr.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
      +sys.stderr.softspace = -1:ValueError:('number must be greater or equal to zero',)
      +<<< Finished
      sys.stdout.attr = None:AttributeError:('invalid attribute: attr',)
      >> OutputWrite
      sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',)
      >> OutputWriteLines
      sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",)
      sys.stdout.writelines([1]):TypeError:('coercing to Unicode: need string or buffer, int found',)
      +>>> Testing *Iter* using sys.stdout.writelines(%s)
      +sys.stdout.writelines(FailingIter()):NotImplementedError:()
      +sys.stdout.writelines(FailingIterNext()):NotImplementedError:()
      +<<< Finished
      > VimCommand
      +>>> Testing StringToChars using vim.command(%s)
      vim.command(1):TypeError:('expected str() or unicode() instance, but got int',)
      +vim.command(u"\0"):TypeError:('expected string without null bytes',)
      +vim.command("\0"):TypeError:('expected string without null bytes',)
      +<<< Finished
      +vim.command("", 2):TypeError:('command() takes exactly one argument (2 given)',)
      > VimToPython
      > VimEval
      +>>> Testing StringToChars using vim.eval(%s)
      vim.eval(1):TypeError:('expected str() or unicode() instance, but got int',)
      +vim.eval(u"\0"):TypeError:('expected string without null bytes',)
      +vim.eval("\0"):TypeError:('expected string without null bytes',)
      +<<< Finished
      +vim.eval("", FailingTrue()):TypeError:('function takes exactly 1 argument (2 given)',)
      > VimEvalPy
      +>>> Testing StringToChars using vim.bindeval(%s)
      vim.bindeval(1):TypeError:('expected str() or unicode() instance, but got int',)
      +vim.bindeval(u"\0"):TypeError:('expected string without null bytes',)
      +vim.bindeval("\0"):TypeError:('expected string without null bytes',)
      +<<< Finished
      +vim.eval("", 2):TypeError:('function takes exactly 1 argument (2 given)',)
      > VimStrwidth
      +>>> Testing StringToChars using vim.strwidth(%s)
      vim.strwidth(1):TypeError:('expected str() or unicode() instance, but got int',)
      +vim.strwidth(u"\0"):TypeError:('expected string without null bytes',)
      +vim.strwidth("\0"):TypeError:('expected string without null bytes',)
      +<<< Finished
      +> VimForeachRTP
      +vim.foreach_rtp(None):TypeError:("'NoneType' object is not callable",)
      +vim.foreach_rtp(NoArgsCall()):TypeError:('__call__() takes exactly 1 argument (2 given)',)
      +vim.foreach_rtp(FailingCall()):NotImplementedError:()
      +vim.foreach_rtp(int, 2):TypeError:('foreach_rtp() takes exactly one argument (2 given)',)
      +> import
      +import xxx_no_such_module_xxx:ImportError:('No module named xxx_no_such_module_xxx',)
      +import failing_import:ImportError:('No module named failing_import',)
      +import failing:ImportError:('No module named failing',)
      > Dictionary
      >> DictionaryConstructor
      vim.Dictionary("abcI"):ValueError:('expected sequence element of size 2, but got sequence of size 1',)
      @@ -509,6 +550,7 @@
      d["a"] = {"abcF" : {u"": 1}}:ValueError:('empty keys are not allowed',)
      d["a"] = {"abcF" : FailingMapping()}:NotImplementedError:()
      d["a"] = {"abcF" : FailingMappingKey()}:NotImplementedError:()
      +d["a"] = {"abcF" : FailingNumber()}:TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing StringToChars using d["a"] = Mapping({%s : 1})
      d["a"] = Mapping({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
      @@ -535,6 +577,7 @@
      d["a"] = Mapping({"abcG" : {u"": 1}}):ValueError:('empty keys are not allowed',)
      d["a"] = Mapping({"abcG" : FailingMapping()}):NotImplementedError:()
      d["a"] = Mapping({"abcG" : FailingMappingKey()}):NotImplementedError:()
      +d["a"] = Mapping({"abcG" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing *Iter* using d["a"] = %s
      d["a"] = FailingIter():TypeError:('unable to convert FailingIter to vim structure',)
      @@ -546,12 +589,17 @@
      d["a"] = {u"": 1}:ValueError:('empty keys are not allowed',)
      d["a"] = FailingMapping():NotImplementedError:()
      d["a"] = FailingMappingKey():NotImplementedError:()
      +d["a"] = FailingNumber():TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >> DictionaryUpdate
      >>> kwargs
      >>> iter
      d.update(FailingMapping()):NotImplementedError:()
      d.update([FailingIterNext()]):NotImplementedError:()
      +>>> Testing *Iter* using d.update(%s)
      +d.update(FailingIter()):NotImplementedError:()
      +d.update(FailingIterNext()):NotImplementedError:()
      +<<< Finished
      >>> Testing StringToChars using d.update({%s : 1})
      d.update({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
      d.update({u"\0" : 1}):TypeError:('expected string without null bytes',)
      @@ -577,6 +625,7 @@
      d.update({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',)
      d.update({"abcF" : FailingMapping()}):NotImplementedError:()
      d.update({"abcF" : FailingMappingKey()}):NotImplementedError:()
      +d.update({"abcF" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing StringToChars using d.update(Mapping({%s : 1}))
      d.update(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',)
      @@ -603,6 +652,7 @@
      d.update(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',)
      d.update(Mapping({"abcG" : FailingMapping()})):NotImplementedError:()
      d.update(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:()
      +d.update(Mapping({"abcG" : FailingNumber()})):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing *Iter* using d.update(%s)
      d.update(FailingIter()):NotImplementedError:()
      @@ -614,6 +664,7 @@
      d.update({u"": 1}):ValueError:('empty keys are not allowed',)
      d.update(FailingMapping()):NotImplementedError:()
      d.update(FailingMappingKey()):NotImplementedError:()
      +d.update(FailingNumber()):TypeError:('iteration over non-sequence',)
      <<< Finished
      >>> Testing StringToChars using d.update(((%s, 0),))
      d.update(((1, 0),)):TypeError:('expected str() or unicode() instance, but got int',)
      @@ -645,6 +696,7 @@
      d.update((("a", {"abcF" : {u"": 1}}),)):ValueError:('empty keys are not allowed',)
      d.update((("a", {"abcF" : FailingMapping()}),)):NotImplementedError:()
      d.update((("a", {"abcF" : FailingMappingKey()}),)):NotImplementedError:()
      +d.update((("a", {"abcF" : FailingNumber()}),)):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),))
      d.update((("a", Mapping({1 : 1})),)):TypeError:('expected str() or unicode() instance, but got int',)
      @@ -671,6 +723,7 @@
      d.update((("a", Mapping({"abcG" : {u"": 1}})),)):ValueError:('empty keys are not allowed',)
      d.update((("a", Mapping({"abcG" : FailingMapping()})),)):NotImplementedError:()
      d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):NotImplementedError:()
      +d.update((("a", Mapping({"abcG" : FailingNumber()})),)):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing *Iter* using d.update((("a", %s),))
      d.update((("a", FailingIter()),)):TypeError:('unable to convert FailingIter to vim structure',)
      @@ -682,6 +735,7 @@
      d.update((("a", {u"": 1}),)):ValueError:('empty keys are not allowed',)
      d.update((("a", FailingMapping()),)):NotImplementedError:()
      d.update((("a", FailingMappingKey()),)):NotImplementedError:()
      +d.update((("a", FailingNumber()),)):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >> DictionaryPopItem
      d.popitem(1, 2):TypeError:('popitem() takes no arguments (2 given)',)
      @@ -691,6 +745,10 @@
      >> ListConstructor
      vim.List(1, 2):TypeError:('function takes at most 1 argument (2 given)',)
      vim.List(a=1):TypeError:('list constructor does not accept keyword arguments',)
      +>>> Testing *Iter* using vim.List(%s)
      +vim.List(FailingIter()):NotImplementedError:()
      +vim.List(FailingIterNext()):NotImplementedError:()
      +<<< Finished
      >>> Testing StringToChars using vim.List([{%s : 1}])
      vim.List([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got int',)
      vim.List([{u"\0" : 1}]):TypeError:('expected string without null bytes',)
      @@ -716,6 +774,7 @@
      vim.List([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',)
      vim.List([{"abcF" : FailingMapping()}]):NotImplementedError:()
      vim.List([{"abcF" : FailingMappingKey()}]):NotImplementedError:()
      +vim.List([{"abcF" : FailingNumber()}]):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing StringToChars using vim.List([Mapping({%s : 1})])
      vim.List([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',)
      @@ -742,6 +801,7 @@
      vim.List([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',)
      vim.List([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:()
      vim.List([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:()
      +vim.List([Mapping({"abcG" : FailingNumber()})]):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing *Iter* using vim.List([%s])
      vim.List([FailingIter()]):TypeError:('unable to convert FailingIter to vim structure',)
      @@ -753,6 +813,7 @@
      vim.List([{u"": 1}]):ValueError:('empty keys are not allowed',)
      vim.List([FailingMapping()]):NotImplementedError:()
      vim.List([FailingMappingKey()]):NotImplementedError:()
      +vim.List([FailingNumber()]):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >> ListItem
      l[1000]:IndexError:('list index out of range',)
      @@ -761,6 +822,10 @@
      l[1000] = 3:IndexError:('list index out of range',)
      >> ListAssSlice
      ll[1:100] = "abcJ":error:('list is locked',)
      +>>> Testing *Iter* using l[:] = %s
      +l[:] = FailingIter():NotImplementedError:()
      +l[:] = FailingIterNext():NotImplementedError:()
      +<<< Finished
      >>> Testing StringToChars using l[:] = [{%s : 1}]
      l[:] = [{1 : 1}]:TypeError:('expected str() or unicode() instance, but got int',)
      l[:] = [{u"\0" : 1}]:TypeError:('expected string without null bytes',)
      @@ -786,6 +851,7 @@
      l[:] = [{"abcF" : {u"": 1}}]:ValueError:('empty keys are not allowed',)
      l[:] = [{"abcF" : FailingMapping()}]:NotImplementedError:()
      l[:] = [{"abcF" : FailingMappingKey()}]:NotImplementedError:()
      +l[:] = [{"abcF" : FailingNumber()}]:TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing StringToChars using l[:] = [Mapping({%s : 1})]
      l[:] = [Mapping({1 : 1})]:TypeError:('expected str() or unicode() instance, but got int',)
      @@ -812,6 +878,7 @@
      l[:] = [Mapping({"abcG" : {u"": 1}})]:ValueError:('empty keys are not allowed',)
      l[:] = [Mapping({"abcG" : FailingMapping()})]:NotImplementedError:()
      l[:] = [Mapping({"abcG" : FailingMappingKey()})]:NotImplementedError:()
      +l[:] = [Mapping({"abcG" : FailingNumber()})]:TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing *Iter* using l[:] = [%s]
      l[:] = [FailingIter()]:TypeError:('unable to convert FailingIter to vim structure',)
      @@ -823,8 +890,13 @@
      l[:] = [{u"": 1}]:ValueError:('empty keys are not allowed',)
      l[:] = [FailingMapping()]:NotImplementedError:()
      l[:] = [FailingMappingKey()]:NotImplementedError:()
      +l[:] = [FailingNumber()]:TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >> ListConcatInPlace
      +>>> Testing *Iter* using l.extend(%s)
      +l.extend(FailingIter()):NotImplementedError:()
      +l.extend(FailingIterNext()):NotImplementedError:()
      +<<< Finished
      >>> Testing StringToChars using l.extend([{%s : 1}])
      l.extend([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got int',)
      l.extend([{u"\0" : 1}]):TypeError:('expected string without null bytes',)
      @@ -850,6 +922,7 @@
      l.extend([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',)
      l.extend([{"abcF" : FailingMapping()}]):NotImplementedError:()
      l.extend([{"abcF" : FailingMappingKey()}]):NotImplementedError:()
      +l.extend([{"abcF" : FailingNumber()}]):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing StringToChars using l.extend([Mapping({%s : 1})])
      l.extend([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',)
      @@ -876,6 +949,7 @@
      l.extend([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',)
      l.extend([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:()
      l.extend([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:()
      +l.extend([Mapping({"abcG" : FailingNumber()})]):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing *Iter* using l.extend([%s])
      l.extend([FailingIter()]):TypeError:('unable to convert FailingIter to vim structure',)
      @@ -887,6 +961,7 @@
      l.extend([{u"": 1}]):ValueError:('empty keys are not allowed',)
      l.extend([FailingMapping()]):NotImplementedError:()
      l.extend([FailingMappingKey()]):NotImplementedError:()
      +l.extend([FailingNumber()]):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >> ListSetattr
      del l.locked:AttributeError:('cannot delete vim.List attributes',)
      @@ -923,6 +998,7 @@
      f({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',)
      f({"abcF" : FailingMapping()}):NotImplementedError:()
      f({"abcF" : FailingMappingKey()}):NotImplementedError:()
      +f({"abcF" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing StringToChars using f(Mapping({%s : 1}))
      f(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',)
      @@ -949,6 +1025,7 @@
      f(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',)
      f(Mapping({"abcG" : FailingMapping()})):NotImplementedError:()
      f(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:()
      +f(Mapping({"abcG" : FailingNumber()})):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing *Iter* using f(%s)
      f(FailingIter()):TypeError:('unable to convert FailingIter to vim structure',)
      @@ -960,6 +1037,7 @@
      f({u"": 1}):ValueError:('empty keys are not allowed',)
      f(FailingMapping()):NotImplementedError:()
      f(FailingMappingKey()):NotImplementedError:()
      +f(FailingNumber()):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing StringToChars using fd(self={%s : 1})
      fd(self={1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
      @@ -986,6 +1064,7 @@
      fd(self={"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',)
      fd(self={"abcF" : FailingMapping()}):NotImplementedError:()
      fd(self={"abcF" : FailingMappingKey()}):NotImplementedError:()
      +fd(self={"abcF" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing StringToChars using fd(self=Mapping({%s : 1}))
      fd(self=Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',)
      @@ -1012,6 +1091,7 @@
      fd(self=Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',)
      fd(self=Mapping({"abcG" : FailingMapping()})):NotImplementedError:()
      fd(self=Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:()
      +fd(self=Mapping({"abcG" : FailingNumber()})):TypeError:('long() argument must be a string or a number',)
      <<< Finished
      >>> Testing *Iter* using fd(self=%s)
      fd(self=FailingIter()):TypeError:('unable to convert FailingIter to vim dictionary',)
      @@ -1023,6 +1103,7 @@
      fd(self={u"": 1}):ValueError:('empty keys are not allowed',)
      fd(self=FailingMapping()):NotImplementedError:()
      fd(self=FailingMappingKey()):NotImplementedError:()
      +fd(self=FailingNumber()):TypeError:('unable to convert FailingNumber to vim dictionary',)
      <<< Finished
      >>> Testing ConvertFromPyMapping using fd(self=%s)
      fd(self=[]):TypeError:('unable to convert object to vim dictionary',)
      @@ -1040,14 +1121,23 @@
      vim.current.window.buffer = 0:TypeError:('readonly attribute: buffer',)
      vim.current.window.cursor = (100000000, 100000000):error:('cursor position outside buffer',)
      vim.current.window.cursor = True:TypeError:('argument must be 2-item sequence, not bool',)
      -vim.current.window.height = "abcK":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',)
      -vim.current.window.width = "abcL":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',)
      +>>> Testing NumberToLong using vim.current.window.height = %s
      +vim.current.window.height = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
      +vim.current.window.height = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
      +vim.current.window.height = -1:ValueError:('number must be greater or equal to zero',)
      +<<< Finished
      +>>> Testing NumberToLong using vim.current.window.width = %s
      +vim.current.window.width = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
      +vim.current.window.width = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
      +vim.current.window.width = -1:ValueError:('number must be greater or equal to zero',)
      +<<< Finished
      vim.current.window.xxxxxx = True:AttributeError:('xxxxxx',)
      > WinList
      >> WinListItem
      vim.windows[1000]:IndexError:('no such window',)
      > Buffer
      >> StringToLine (indirect)
      +vim.current.buffer[0] = u"\na":error:('string cannot contain newlines',)
      vim.current.buffer[0] = "\na":error:('string cannot contain newlines',)
      >> SetBufferLine (indirect)
      vim.current.buffer[0] = True:TypeError:('bad argument type for built-in operation',)
      @@ -1075,8 +1165,13 @@
      vim.current.buffer.range(1, 2, 3):TypeError:('function takes exactly 2 arguments (3 given)',)
      > BufMap
      >> BufMapItem
      +vim.buffers[100000000]:KeyError:(100000000,)
      +>>> Testing NumberToLong using vim.buffers[%s]
      +vim.buffers[[]]:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
      vim.buffers[None]:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
      -vim.buffers[100000000]:KeyError:(100000000,)
      +vim.buffers[-1]:ValueError:('number must be greater then zero',)
      +vim.buffers[0]:ValueError:('number must be greater then zero',)
      +<<< Finished
      > Current
      >> CurrentGetattr
      vim.current.xxx:AttributeError:('xxx',)
      @@ -1086,9 +1181,14 @@
      vim.current.window = True:TypeError:('expected vim.Window object, but got bool',)
      vim.current.tabpage = True:TypeError:('expected vim.TabPage object, but got bool',)
      vim.current.xxx = True:AttributeError:('xxx',)
      +['/testdir']
      +'/testdir'
      2,xx
      before
      after
      +pythonx/topmodule/__init__.py
      +pythonx/topmodule/submodule/__init__.py
      +pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py
      vim.command("throw 'abcN'"):error:('abcN',)
      Exe("throw 'def'"):error:('def',)
      vim.eval("Exe('throw ''ghi''')"):error:('ghi',)
      diff --git a/src/testdir/test87.in b/src/testdir/test87.in
      --- a/src/testdir/test87.in
      +++ b/src/testdir/test87.in
      @@ -335,9 +335,9 @@
      EOF
      :py3 sys.settrace(traceit)
      :py3 trace_main()
      +:py3 sys.settrace(None)
      :py3 del traceit
      :py3 del trace_main
      -:py3 sys.settrace(None)
      :$put =string(l)
      :"
      :" Vars
      @@ -898,6 +898,7 @@
      '{"": 1}', # Same, but with unicode object
      'FailingMapping()', #
      'FailingMappingKey()', #
      + 'FailingNumber()', #
      ))

      def convertfrompymapping_test(expr):
      @@ -912,6 +913,15 @@
      'FailingIterNext()',
      ))

      +def number_test(expr, natural=False, unsigned=False):
      + if natural:
      + unsigned = True
      + return subexpr_test(expr, 'NumberToLong', (
      + '[]',
      + 'None',
      + ) + (('-1',) if unsigned else ())
      + + (('0',) if natural else ()))
      +
      class FailingTrue(object):
      def __bool__(self):
      raise NotImplementedError
      @@ -948,10 +958,23 @@
      else:
      return super(FailingList, self).__getitem__(idx)

      +class NoArgsCall(object):
      + def __call__(self):
      + pass
      +
      +class FailingCall(object):
      + def __call__(self, path):
      + raise NotImplementedError
      +
      +class FailingNumber(object):
      + def __int__(self):
      + raise NotImplementedError
      +
      cb.append("> Output")
      cb.append(">> OutputSetattr")
      ee('del sys.stdout.softspace')
      -ee('sys.stdout.softspace = []')
      +number_test('sys.stdout.softspace = %s', unsigned=True)
      +number_test('sys.stderr.softspace = %s', unsigned=True)
      ee('sys.stdout.attr = None')
      cb.append(">> OutputWrite")
      ee('sys.stdout.write(None)')
      @@ -960,18 +983,34 @@
      ee('sys.stdout.writelines([1])')
      iter_test('sys.stdout.writelines(%s)')
      cb.append("> VimCommand")
      -ee('vim.command(1)')
      +stringtochars_test('vim.command(%s)')
      +ee('vim.command("", 2)')
      #! Not checked: vim->python exceptions translating: checked later
      cb.append("> VimToPython")
      #! Not checked: everything: needs errors in internal python functions
      cb.append("> VimEval")
      -ee('vim.eval(1)')
      +stringtochars_test('vim.eval(%s)')
      +ee('vim.eval("", FailingTrue())')
      #! Not checked: everything: needs errors in internal python functions
      cb.append("> VimEvalPy")
      -ee('vim.bindeval(1)')
      +stringtochars_test('vim.bindeval(%s)')
      +ee('vim.eval("", 2)')
      #! Not checked: vim->python exceptions translating: checked later
      cb.append("> VimStrwidth")
      -ee('vim.strwidth(1)')
      +stringtochars_test('vim.strwidth(%s)')
      +cb.append("> VimForeachRTP")
      +ee('vim.foreach_rtp(None)')
      +ee('vim.foreach_rtp(NoArgsCall())')
      +ee('vim.foreach_rtp(FailingCall())')
      +ee('vim.foreach_rtp(int, 2)')
      +cb.append('> import')
      +old_rtp = vim.options['rtp']
      +vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
      +ee('import xxx_no_such_module_xxx')
      +ee('import failing_import')
      +ee('import failing')
      +vim.options['rtp'] = old_rtp
      +del old_rtp
      cb.append("> Dictionary")
      cb.append(">> DictionaryConstructor")
      ee('vim.Dictionary("abcI")')
      @@ -1050,8 +1089,8 @@
      ee('vim.current.window.buffer = 0')
      ee('vim.current.window.cursor = (100000000, 100000000)')
      ee('vim.current.window.cursor = True')
      -ee('vim.current.window.height = "abcK"')
      -ee('vim.current.window.width = "abcL"')
      +number_test('vim.current.window.height = %s', unsigned=True)
      +number_test('vim.current.window.width = %s', unsigned=True)
      ee('vim.current.window.xxxxxx = True')
      cb.append("> WinList")
      cb.append(">> WinListItem")
      @@ -1059,6 +1098,7 @@
      cb.append("> Buffer")
      cb.append(">> StringToLine (indirect)")
      ee('vim.current.buffer[0] = "\\na"')
      +ee('vim.current.buffer[0] = b"\\na"')
      cb.append(">> SetBufferLine (indirect)")
      ee('vim.current.buffer[0] = True')
      cb.append(">> SetBufferLineList (indirect)")
      @@ -1085,8 +1125,8 @@
      ee('vim.current.buffer.range(1, 2, 3)')
      cb.append("> BufMap")
      cb.append(">> BufMapItem")
      -ee('vim.buffers[None]')
      ee('vim.buffers[100000000]')
      +number_test('vim.buffers[%s]', natural=True)
      cb.append("> Current")
      cb.append(">> CurrentGetattr")
      ee('vim.current.xxx')
      @@ -1110,12 +1150,16 @@
      del convertfrompyobject_test
      del convertfrompymapping_test
      del iter_test
      +del number_test
      del FailingTrue
      del FailingIter
      del FailingIterNext
      del FailingMapping
      del FailingMappingKey
      del FailingList
      +del NoArgsCall
      +del FailingCall
      +del FailingNumber
      EOF
      :delfunction F
      :"
      @@ -1124,6 +1168,16 @@
      sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
      sys.path.append(os.path.join(os.getcwd(), 'python_after'))
      vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
      +l = []
      +def callback(path):
      + l.append(os.path.relpath(path))
      +vim.foreach_rtp(callback)
      +cb.append(repr(l))
      +del l
      +def callback(path):
      + return os.path.relpath(path)
      +cb.append(repr(vim.foreach_rtp(callback)))
      +del callback
      from module import dir as d
      from modulex import ddir
      cb.append(d + ',' + ddir)
      @@ -1131,10 +1185,19 @@
      cb.append(before.dir)
      import after
      cb.append(after.dir)
      +import topmodule as tm
      +import topmodule.submodule as tms
      +import topmodule.submodule.subsubmodule.subsubsubmodule as tmsss
      +cb.append(tm.__file__[-len('modulex/topmodule/__init__.py'):])
      +cb.append(tms.__file__[-len('modulex/topmodule/submodule/__init__.py'):])
      +cb.append(tmsss.__file__[-len('modulex/topmodule/submodule/subsubmodule/subsubsubmodule.py'):])
      del before
      del after
      del d
      del ddir
      +del tm
      +del tms
      +del tmsss
      EOF
      :"
      :" Test exceptions
      diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok
      --- a/src/testdir/test87.ok
      +++ b/src/testdir/test87.ok
      @@ -430,7 +430,16 @@
      > Output
      >> OutputSetattr
      del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError("can't delete OutputObject attributes",))
      +>>> Testing NumberToLong using sys.stdout.softspace = %s
      sys.stdout.softspace = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',))
      +sys.stdout.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
      +sys.stdout.softspace = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',))
      +<<< Finished
      +>>> Testing NumberToLong using sys.stderr.softspace = %s
      +sys.stderr.softspace = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',))
      +sys.stderr.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
      +sys.stderr.softspace = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',))
      +<<< Finished
      sys.stdout.attr = None:(<class 'AttributeError'>, AttributeError('invalid attribute: attr',))
      >> OutputWrite
      sys.stdout.write(None):(<class 'TypeError'>, TypeError("Can't convert 'NoneType' object to str implicitly",))
      @@ -442,14 +451,42 @@
      sys.stdout.writelines(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      > VimCommand
      +>>> Testing StringToChars using vim.command(%s)
      vim.command(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      +vim.command(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
      +vim.command("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
      +<<< Finished
      +vim.command("", 2):(<class 'TypeError'>, TypeError('command() takes exactly one argument (2 given)',))
      > VimToPython
      > VimEval
      +>>> Testing StringToChars using vim.eval(%s)
      vim.eval(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      +vim.eval(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
      +vim.eval("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
      +<<< Finished
      +vim.eval("", FailingTrue()):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',))
      > VimEvalPy
      +>>> Testing StringToChars using vim.bindeval(%s)
      vim.bindeval(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      +vim.bindeval(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
      +vim.bindeval("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
      +<<< Finished
      +vim.eval("", 2):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',))
      > VimStrwidth
      +>>> Testing StringToChars using vim.strwidth(%s)
      vim.strwidth(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      +vim.strwidth(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
      +vim.strwidth("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
      +<<< Finished
      +> VimForeachRTP
      +vim.foreach_rtp(None):(<class 'TypeError'>, TypeError("'NoneType' object is not callable",))
      +vim.foreach_rtp(NoArgsCall()):(<class 'TypeError'>, TypeError('__call__() takes exactly 1 positional argument (2 given)',))
      +vim.foreach_rtp(FailingCall()):(<class 'NotImplementedError'>, NotImplementedError())
      +vim.foreach_rtp(int, 2):(<class 'TypeError'>, TypeError('foreach_rtp() takes exactly one argument (2 given)',))
      +> import
      +import xxx_no_such_module_xxx:(<class 'ImportError'>, ImportError('No module named xxx_no_such_module_xxx',))
      +import failing_import:(<class 'ImportError'>, ImportError('No module named failing_import',))
      +import failing:(<class 'ImportError'>, ImportError('No module named failing',))
      > Dictionary
      >> DictionaryConstructor
      vim.Dictionary("abcI"):(<class 'ValueError'>, ValueError('expected sequence element of size 2, but got sequence of size 1',))
      @@ -502,6 +539,7 @@
      d["a"] = {"abcF" : {"": 1}}:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      d["a"] = {"abcF" : FailingMapping()}:(<class 'NotImplementedError'>, NotImplementedError())
      d["a"] = {"abcF" : FailingMappingKey()}:(<class 'NotImplementedError'>, NotImplementedError())
      +d["a"] = {"abcF" : FailingNumber()}:(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing StringToChars using d["a"] = Mapping({%s : 1})
      d["a"] = Mapping({1 : 1}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -528,6 +566,7 @@
      d["a"] = Mapping({"abcG" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      d["a"] = Mapping({"abcG" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError())
      d["a"] = Mapping({"abcG" : FailingMappingKey()}):(<class 'NotImplementedError'>, NotImplementedError())
      +d["a"] = Mapping({"abcG" : FailingNumber()}):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing *Iter* using d["a"] = %s
      d["a"] = FailingIter():(<class 'TypeError'>, TypeError('unable to convert FailingIter to vim structure',))
      @@ -539,6 +578,7 @@
      d["a"] = {"": 1}:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      d["a"] = FailingMapping():(<class 'NotImplementedError'>, NotImplementedError())
      d["a"] = FailingMappingKey():(<class 'NotImplementedError'>, NotImplementedError())
      +d["a"] = FailingNumber():(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >> DictionaryUpdate
      >>> kwargs
      @@ -574,6 +614,7 @@
      d.update({"abcF" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      d.update({"abcF" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError())
      d.update({"abcF" : FailingMappingKey()}):(<class 'NotImplementedError'>, NotImplementedError())
      +d.update({"abcF" : FailingNumber()}):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing StringToChars using d.update(Mapping({%s : 1}))
      d.update(Mapping({1 : 1})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -600,6 +641,7 @@
      d.update(Mapping({"abcG" : {"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      d.update(Mapping({"abcG" : FailingMapping()})):(<class 'NotImplementedError'>, NotImplementedError())
      d.update(Mapping({"abcG" : FailingMappingKey()})):(<class 'NotImplementedError'>, NotImplementedError())
      +d.update(Mapping({"abcG" : FailingNumber()})):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing *Iter* using d.update(%s)
      d.update(FailingIter()):(<class 'NotImplementedError'>, NotImplementedError())
      @@ -611,6 +653,7 @@
      d.update({"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      d.update(FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError())
      d.update(FailingMappingKey()):(<class 'NotImplementedError'>, NotImplementedError())
      +d.update(FailingNumber()):(<class 'TypeError'>, TypeError("'FailingNumber' object is not iterable",))
      <<< Finished
      >>> Testing StringToChars using d.update(((%s, 0),))
      d.update(((1, 0),)):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -642,6 +685,7 @@
      d.update((("a", {"abcF" : {"": 1}}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      d.update((("a", {"abcF" : FailingMapping()}),)):(<class 'NotImplementedError'>, NotImplementedError())
      d.update((("a", {"abcF" : FailingMappingKey()}),)):(<class 'NotImplementedError'>, NotImplementedError())
      +d.update((("a", {"abcF" : FailingNumber()}),)):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),))
      d.update((("a", Mapping({1 : 1})),)):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -668,6 +712,7 @@
      d.update((("a", Mapping({"abcG" : {"": 1}})),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      d.update((("a", Mapping({"abcG" : FailingMapping()})),)):(<class 'NotImplementedError'>, NotImplementedError())
      d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):(<class 'NotImplementedError'>, NotImplementedError())
      +d.update((("a", Mapping({"abcG" : FailingNumber()})),)):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing *Iter* using d.update((("a", %s),))
      d.update((("a", FailingIter()),)):(<class 'TypeError'>, TypeError('unable to convert FailingIter to vim structure',))
      @@ -679,6 +724,7 @@
      d.update((("a", {"": 1}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      d.update((("a", FailingMapping()),)):(<class 'NotImplementedError'>, NotImplementedError())
      d.update((("a", FailingMappingKey()),)):(<class 'NotImplementedError'>, NotImplementedError())
      +d.update((("a", FailingNumber()),)):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >> DictionaryPopItem
      d.popitem(1, 2):(<class 'TypeError'>, TypeError('popitem() takes no arguments (2 given)',))
      @@ -717,6 +763,7 @@
      vim.List([{"abcF" : {"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      vim.List([{"abcF" : FailingMapping()}]):(<class 'NotImplementedError'>, NotImplementedError())
      vim.List([{"abcF" : FailingMappingKey()}]):(<class 'NotImplementedError'>, NotImplementedError())
      +vim.List([{"abcF" : FailingNumber()}]):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing StringToChars using vim.List([Mapping({%s : 1})])
      vim.List([Mapping({1 : 1})]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -743,6 +790,7 @@
      vim.List([Mapping({"abcG" : {"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      vim.List([Mapping({"abcG" : FailingMapping()})]):(<class 'NotImplementedError'>, NotImplementedError())
      vim.List([Mapping({"abcG" : FailingMappingKey()})]):(<class 'NotImplementedError'>, NotImplementedError())
      +vim.List([Mapping({"abcG" : FailingNumber()})]):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing *Iter* using vim.List([%s])
      vim.List([FailingIter()]):(<class 'TypeError'>, TypeError('unable to convert FailingIter to vim structure',))
      @@ -754,6 +802,7 @@
      vim.List([{"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      vim.List([FailingMapping()]):(<class 'NotImplementedError'>, NotImplementedError())
      vim.List([FailingMappingKey()]):(<class 'NotImplementedError'>, NotImplementedError())
      +vim.List([FailingNumber()]):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >> ListItem
      l[1000]:(<class 'IndexError'>, IndexError('list index out of range',))
      @@ -791,6 +840,7 @@
      l[:] = [{"abcF" : {"": 1}}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      l[:] = [{"abcF" : FailingMapping()}]:(<class 'NotImplementedError'>, NotImplementedError())
      l[:] = [{"abcF" : FailingMappingKey()}]:(<class 'NotImplementedError'>, NotImplementedError())
      +l[:] = [{"abcF" : FailingNumber()}]:(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing StringToChars using l[:] = [Mapping({%s : 1})]
      l[:] = [Mapping({1 : 1})]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -817,6 +867,7 @@
      l[:] = [Mapping({"abcG" : {"": 1}})]:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      l[:] = [Mapping({"abcG" : FailingMapping()})]:(<class 'NotImplementedError'>, NotImplementedError())
      l[:] = [Mapping({"abcG" : FailingMappingKey()})]:(<class 'NotImplementedError'>, NotImplementedError())
      +l[:] = [Mapping({"abcG" : FailingNumber()})]:(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing *Iter* using l[:] = [%s]
      l[:] = [FailingIter()]:(<class 'TypeError'>, TypeError('unable to convert FailingIter to vim structure',))
      @@ -828,6 +879,7 @@
      l[:] = [{"": 1}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      l[:] = [FailingMapping()]:(<class 'NotImplementedError'>, NotImplementedError())
      l[:] = [FailingMappingKey()]:(<class 'NotImplementedError'>, NotImplementedError())
      +l[:] = [FailingNumber()]:(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >> ListConcatInPlace
      >>> Testing *Iter* using l.extend(%s)
      @@ -859,6 +911,7 @@
      l.extend([{"abcF" : {"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      l.extend([{"abcF" : FailingMapping()}]):(<class 'NotImplementedError'>, NotImplementedError())
      l.extend([{"abcF" : FailingMappingKey()}]):(<class 'NotImplementedError'>, NotImplementedError())
      +l.extend([{"abcF" : FailingNumber()}]):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing StringToChars using l.extend([Mapping({%s : 1})])
      l.extend([Mapping({1 : 1})]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -885,6 +938,7 @@
      l.extend([Mapping({"abcG" : {"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      l.extend([Mapping({"abcG" : FailingMapping()})]):(<class 'NotImplementedError'>, NotImplementedError())
      l.extend([Mapping({"abcG" : FailingMappingKey()})]):(<class 'NotImplementedError'>, NotImplementedError())
      +l.extend([Mapping({"abcG" : FailingNumber()})]):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing *Iter* using l.extend([%s])
      l.extend([FailingIter()]):(<class 'TypeError'>, TypeError('unable to convert FailingIter to vim structure',))
      @@ -896,6 +950,7 @@
      l.extend([{"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      l.extend([FailingMapping()]):(<class 'NotImplementedError'>, NotImplementedError())
      l.extend([FailingMappingKey()]):(<class 'NotImplementedError'>, NotImplementedError())
      +l.extend([FailingNumber()]):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >> ListSetattr
      del l.locked:(<class 'AttributeError'>, AttributeError('cannot delete vim.List attributes',))
      @@ -932,6 +987,7 @@
      f({"abcF" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      f({"abcF" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError())
      f({"abcF" : FailingMappingKey()}):(<class 'NotImplementedError'>, NotImplementedError())
      +f({"abcF" : FailingNumber()}):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing StringToChars using f(Mapping({%s : 1}))
      f(Mapping({1 : 1})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -958,6 +1014,7 @@
      f(Mapping({"abcG" : {"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      f(Mapping({"abcG" : FailingMapping()})):(<class 'NotImplementedError'>, NotImplementedError())
      f(Mapping({"abcG" : FailingMappingKey()})):(<class 'NotImplementedError'>, NotImplementedError())
      +f(Mapping({"abcG" : FailingNumber()})):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing *Iter* using f(%s)
      f(FailingIter()):(<class 'TypeError'>, TypeError('unable to convert FailingIter to vim structure',))
      @@ -969,6 +1026,7 @@
      f({"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      f(FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError())
      f(FailingMappingKey()):(<class 'NotImplementedError'>, NotImplementedError())
      +f(FailingNumber()):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing StringToChars using fd(self={%s : 1})
      fd(self={1 : 1}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -995,6 +1053,7 @@
      fd(self={"abcF" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      fd(self={"abcF" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError())
      fd(self={"abcF" : FailingMappingKey()}):(<class 'NotImplementedError'>, NotImplementedError())
      +fd(self={"abcF" : FailingNumber()}):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing StringToChars using fd(self=Mapping({%s : 1}))
      fd(self=Mapping({1 : 1})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
      @@ -1021,6 +1080,7 @@
      fd(self=Mapping({"abcG" : {"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      fd(self=Mapping({"abcG" : FailingMapping()})):(<class 'NotImplementedError'>, NotImplementedError())
      fd(self=Mapping({"abcG" : FailingMappingKey()})):(<class 'NotImplementedError'>, NotImplementedError())
      +fd(self=Mapping({"abcG" : FailingNumber()})):(<class 'NotImplementedError'>, NotImplementedError())
      <<< Finished
      >>> Testing *Iter* using fd(self=%s)
      fd(self=FailingIter()):(<class 'TypeError'>, TypeError('unable to convert FailingIter to vim dictionary',))
      @@ -1032,6 +1092,7 @@
      fd(self={"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',))
      fd(self=FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError())
      fd(self=FailingMappingKey()):(<class 'NotImplementedError'>, NotImplementedError())
      +fd(self=FailingNumber()):(<class 'TypeError'>, TypeError('unable to convert FailingNumber to vim dictionary',))
      <<< Finished
      >>> Testing ConvertFromPyMapping using fd(self=%s)
      fd(self=[]):(<class 'AttributeError'>, AttributeError('keys',))
      @@ -1049,8 +1110,16 @@
      vim.current.window.buffer = 0:(<class 'TypeError'>, TypeError('readonly attribute: buffer',))
      vim.current.window.cursor = (100000000, 100000000):(<class 'vim.error'>, error('cursor position outside buffer',))
      vim.current.window.cursor = True:(<class 'TypeError'>, TypeError('argument must be 2-item sequence, not bool',))
      -vim.current.window.height = "abcK":(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got str',))
      -vim.current.window.width = "abcL":(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got str',))
      +>>> Testing NumberToLong using vim.current.window.height = %s
      +vim.current.window.height = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',))
      +vim.current.window.height = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
      +vim.current.window.height = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',))
      +<<< Finished
      +>>> Testing NumberToLong using vim.current.window.width = %s
      +vim.current.window.width = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',))
      +vim.current.window.width = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
      +vim.current.window.width = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',))
      +<<< Finished
      vim.current.window.xxxxxx = True:(<class 'AttributeError'>, AttributeError('xxxxxx',))
      > WinList
      >> WinListItem
      @@ -1058,6 +1127,7 @@
      > Buffer
      >> StringToLine (indirect)
      vim.current.buffer[0] = "\na":(<class 'vim.error'>, error('string cannot contain newlines',))
      +vim.current.buffer[0] = b"\na":(<class 'vim.error'>, error('string cannot contain newlines',))
      >> SetBufferLine (indirect)
      vim.current.buffer[0] = True:(<class 'TypeError'>, TypeError('bad argument type for built-in operation',))
      >> SetBufferLineList (indirect)
      @@ -1084,8 +1154,13 @@
      vim.current.buffer.range(1, 2, 3):(<class 'TypeError'>, TypeError('function takes exactly 2 arguments (3 given)',))
      > BufMap
      >> BufMapItem
      +vim.buffers[100000000]:(<class 'KeyError'>, KeyError(100000000,))
      +>>> Testing NumberToLong using vim.buffers[%s]
      +vim.buffers[[]]:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',))
      vim.buffers[None]:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
      -vim.buffers[100000000]:(<class 'KeyError'>, KeyError(100000000,))
      +vim.buffers[-1]:(<class 'ValueError'>, ValueError('number must be greater then zero',))
      +vim.buffers[0]:(<class 'ValueError'>, ValueError('number must be greater then zero',))
      +<<< Finished
      > Current
      >> CurrentGetattr
      vim.current.xxx:(<class 'AttributeError'>, AttributeError("'vim.currentdata' object has no attribute 'xxx'",))
      @@ -1095,9 +1170,14 @@
      vim.current.window = True:(<class 'TypeError'>, TypeError('expected vim.Window object, but got bool',))
      vim.current.tabpage = True:(<class 'TypeError'>, TypeError('expected vim.TabPage object, but got bool',))
      vim.current.xxx = True:(<class 'AttributeError'>, AttributeError('xxx',))
      +['.']
      +'.'
      3,xx
      before
      after
      +pythonx/topmodule/__init__.py
      +pythonx/topmodule/submodule/__init__.py
      +pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py
      vim.command("throw 'abcN'"):(<class 'vim.error'>, error('abcN',))
      Exe("throw 'def'"):(<class 'vim.error'>, error('def',))
      vim.eval("Exe('throw ''ghi''')"):(<class 'vim.error'>, error('ghi',))

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 25 messages in this topic