annotate src/testdir/test_python2.vim @ 35172:c98f002b1fe4 default tip

runtime(doc): fix typo in usr_52.txt Commit: https://github.com/vim/vim/commit/b7258738f80f26be302a84a99f968b3bdc2f29bb Author: Christian Brabandt <cb@256bit.org> Date: Sun May 12 19:04:47 2024 +0200 runtime(doc): fix typo in usr_52.txt fixes: https://github.com/vim/vim/issues/14758 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 12 May 2024 19:15:08 +0200
parents daaff6843090
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10751
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for python 2 commands.
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 CheckFeature python
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
5 CheckFeature quickfix
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
6 source shared.vim
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
7
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
8 " NOTE: This will cause errors when run under valgrind.
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
9 " This would require recompiling Python with:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
10 " ./configure --without-pymalloc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
11 " See http://svn.python.org/view/python/trunk/Misc/README.valgrind?view=markup
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
12 "
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
13
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
14 " This function should be called first. This sets up python functions used by
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
15 " the other tests.
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
16 func Test_AAA_python_setup()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
17 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
18 import vim
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
19 import sys
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
20
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
21 def emsg(ei):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
22 return ei[0].__name__ + ':' + repr(ei[1].args)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
23
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
24 def ee(expr, g=globals(), l=locals()):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
25 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
26 exec(expr, g, l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
27 except:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
28 ei = sys.exc_info()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
29 msg = emsg(ei)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
30 msg = msg.replace('TypeError:(\'argument 1 ', 'TypeError:(\'')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
31 if expr.find('None') > -1:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
32 msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
33 'TypeError:("\'NoneType\' object is not iterable",)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
34 if expr.find('FailingNumber') > -1:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
35 msg = msg.replace(', not \'FailingNumber\'', '').replace('"', '\'')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
36 msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
37 'TypeError:("\'FailingNumber\' object is not iterable",)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
38 if msg.find('(\'\'') > -1 or msg.find('(\'can\'t') > -1:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
39 msg = msg.replace('(\'', '("').replace('\',)', '",)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
40 # Some Python versions say can't, others cannot.
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
41 if msg.find('can\'t') > -1:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
42 msg = msg.replace('can\'t', 'cannot')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
43 # Some Python versions use single quote, some double quote
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
44 if msg.find('"cannot ') > -1:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
45 msg = msg.replace('"cannot ', '\'cannot ')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
46 if msg.find(' attributes"') > -1:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
47 msg = msg.replace(' attributes"', ' attributes\'')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
48 if expr == 'fd(self=[])':
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
49 # HACK: PyMapping_Check changed meaning
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
50 msg = msg.replace('AttributeError:(\'keys\',)',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
51 'TypeError:(\'unable to convert list to vim dictionary\',)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
52 vim.current.buffer.append(expr + ':' + msg)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
53 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
54 vim.current.buffer.append(expr + ':NOT FAILED')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
55 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
56 endfunc
10751
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 func Test_pydo()
34234
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
59 new
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
60
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
61 " Check deleting lines does not trigger an ml_get error.
10751
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call setline(1, ['one', 'two', 'three'])
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 pydo vim.command("%d_")
34234
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
64 call assert_equal([''], getline(1, '$'))
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
65
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
66 call setline(1, ['one', 'two', 'three'])
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
67 pydo vim.command("1,2d_")
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
68 call assert_equal(['three'], getline(1, '$'))
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
69
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
70 call setline(1, ['one', 'two', 'three'])
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
71 pydo vim.command("2,3d_"); return "REPLACED"
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
72 call assert_equal(['REPLACED'], getline(1, '$'))
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
73
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
74 call setline(1, ['one', 'two', 'three'])
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
75 2,3pydo vim.command("1,2d_"); return "REPLACED"
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
76 call assert_equal(['three'], getline(1, '$'))
daaff6843090 patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents: 30310
diff changeset
77
10751
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 bwipe!
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
80 " Check switching to another buffer does not trigger an ml_get error.
10751
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 new
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 let wincount = winnr('$')
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call setline(1, ['one', 'two', 'three'])
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 pydo vim.command("new")
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call assert_equal(wincount + 1, winnr('$'))
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 bwipe!
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 bwipe!
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
88
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
89 " Try modifying a buffer with 'nomodifiable' set
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
90 set nomodifiable
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21200
diff changeset
91 call assert_fails('pydo toupper(line)', 'E21:')
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
92 set modifiable
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
93
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
94 " Invalid command
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
95 call AssertException(['pydo non_existing_cmd'],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
96 \ "Vim(pydo):NameError: global name 'non_existing_cmd' is not defined")
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
97 call AssertException(["pydo raise Exception('test')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
98 \ 'Vim(pydo):Exception: test')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
99 call AssertException(["pydo {lambda}"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
100 \ 'Vim(pydo):SyntaxError: invalid syntax')
10751
27b42717662b patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 endfunc
14395
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
102
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
103 func Test_set_cursor()
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
104 " Check that setting the cursor position works.
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
105 new
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
106 call setline(1, ['first line', 'second line'])
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
107 normal gg
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
108 pydo vim.current.window.cursor = (1, 5)
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
109 call assert_equal([1, 6], [line('.'), col('.')])
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
110
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
111 " Check that movement after setting cursor position keeps current column.
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
112 normal j
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
113 call assert_equal([2, 6], [line('.'), col('.')])
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 10751
diff changeset
114 endfunc
15234
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
115
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
116 func Test_vim_function()
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
117 " Check creating vim.Function object
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
118
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
119 func s:foo()
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
120 return matchstr(expand('<sfile>'), '<SNR>\zs\d\+_foo$')
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
121 endfunc
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
122 let name = '<SNR>' . s:foo()
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
123
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
124 try
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
125 py f = vim.bindeval('function("s:foo")')
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
126 call assert_equal(name, pyeval('f.name'))
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
127 catch
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
128 call assert_false(v:exception)
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
129 endtry
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
130
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
131 try
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
132 py f = vim.Function('\x80\xfdR' + vim.eval('s:foo()'))
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
133 call assert_equal(name, 'f.name'->pyeval())
15234
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
134 catch
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
135 call assert_false(v:exception)
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
136 endtry
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
137
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
138 " Non-existing function attribute
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
139 call AssertException(["let x = pyeval('f.abc')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
140 \ 'Vim(let):AttributeError: abc')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
141
15234
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
142 py del f
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
143 delfunc s:foo
ee63f4fe3d45 patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents: 14395
diff changeset
144 endfunc
15888
a83c4b1f8ea2 patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents: 15234
diff changeset
145
a83c4b1f8ea2 patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents: 15234
diff changeset
146 func Test_skipped_python_command_does_not_affect_pyxversion()
a83c4b1f8ea2 patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents: 15234
diff changeset
147 set pyxversion=0
a83c4b1f8ea2 patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents: 15234
diff changeset
148 if 0
a83c4b1f8ea2 patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents: 15234
diff changeset
149 python import vim
a83c4b1f8ea2 patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents: 15234
diff changeset
150 endif
a83c4b1f8ea2 patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents: 15234
diff changeset
151 call assert_equal(0, &pyxversion) " This assertion would have failed with Vim 8.0.0251. (pyxversion was introduced in 8.0.0251.)
a83c4b1f8ea2 patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents: 15234
diff changeset
152 endfunc
16080
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
153
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
154 func _SetUpHiddenBuffer()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
155 new
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
156 edit hidden
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
157 setlocal bufhidden=hide
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
158
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
159 enew
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
160 let lnum = 0
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
161 while lnum < 10
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
162 call append( 1, string( lnum ) )
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
163 let lnum = lnum + 1
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
164 endwhile
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
165 normal G
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
166
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
167 call assert_equal( line( '.' ), 11 )
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
168 endfunc
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
169
16138
402b714cb919 patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 16080
diff changeset
170 func _CleanUpHiddenBuffer()
402b714cb919 patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 16080
diff changeset
171 bwipe! hidden
402b714cb919 patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 16080
diff changeset
172 bwipe!
402b714cb919 patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 16080
diff changeset
173 endfunc
402b714cb919 patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 16080
diff changeset
174
16080
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
175 func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_Clear()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
176 call _SetUpHiddenBuffer()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
177 py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][:] = None
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
178 call assert_equal( line( '.' ), 11 )
16138
402b714cb919 patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 16080
diff changeset
179 call _CleanUpHiddenBuffer()
16080
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
180 endfunc
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
181
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
182 func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_List()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
183 call _SetUpHiddenBuffer()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
184 py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][:] = [ 'test' ]
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
185 call assert_equal( line( '.' ), 11 )
16138
402b714cb919 patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 16080
diff changeset
186 call _CleanUpHiddenBuffer()
16080
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
187 endfunc
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
188
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
189 func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_Str()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
190 call _SetUpHiddenBuffer()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
191 py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][0] = 'test'
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
192 call assert_equal( line( '.' ), 11 )
16138
402b714cb919 patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 16080
diff changeset
193 call _CleanUpHiddenBuffer()
16080
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
194 endfunc
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
195
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
196 func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_ClearLine()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
197 call _SetUpHiddenBuffer()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
198 py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][0] = None
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
199 call assert_equal( line( '.' ), 11 )
16138
402b714cb919 patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 16080
diff changeset
200 call _CleanUpHiddenBuffer()
16080
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
201 endfunc
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
202
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
203 func _SetUpVisibleBuffer()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
204 new
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
205 let lnum = 0
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
206 while lnum < 10
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
207 call append( 1, string( lnum ) )
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
208 let lnum = lnum + 1
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
209 endwhile
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
210 normal G
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
211 call assert_equal( line( '.' ), 11 )
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
212 endfunc
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
213
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
214 func Test_Write_To_Current_Buffer_Fixes_Cursor_Clear()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
215 call _SetUpVisibleBuffer()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
216
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
217 py vim.current.buffer[:] = None
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
218 call assert_equal( line( '.' ), 1 )
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
219
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
220 bwipe!
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
221 endfunc
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
222
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
223 func Test_Write_To_Current_Buffer_Fixes_Cursor_List()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
224 call _SetUpVisibleBuffer()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
225
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
226 py vim.current.buffer[:] = [ 'test' ]
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
227 call assert_equal( line( '.' ), 1 )
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
228
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
229 bwipe!
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
230 endfunc
16080
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
231
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
232 func Test_Write_To_Current_Buffer_Fixes_Cursor_Str()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
233 call _SetUpVisibleBuffer()
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
234
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
235 py vim.current.buffer[-1] = None
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
236 call assert_equal( line( '.' ), 10 )
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
237
bf8cf5c3b784 patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents: 15888
diff changeset
238 bwipe!
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
239 endfunc
16688
e791f29affae patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents: 16138
diff changeset
240
e791f29affae patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents: 16138
diff changeset
241 func Test_Catch_Exception_Message()
e791f29affae patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents: 16138
diff changeset
242 try
e791f29affae patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents: 16138
diff changeset
243 py raise RuntimeError( 'TEST' )
e791f29affae patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents: 16138
diff changeset
244 catch /.*/
e791f29affae patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents: 16138
diff changeset
245 call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception )
e791f29affae patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents: 16138
diff changeset
246 endtry
e791f29affae patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents: 16138
diff changeset
247 endfunc
20045
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
248
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
249 " Test for various heredoc syntax
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
250 func Test_python_heredoc()
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
251 python << END
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
252 s='A'
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
253 END
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
254 python <<
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
255 s+='B'
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
256 .
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
257 python << trim END
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
258 s+='C'
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
259 END
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
260 python << trim
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
261 s+='D'
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
262 .
20233
5f9c2c7d3d73 patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents: 20045
diff changeset
263 python << trim eof
5f9c2c7d3d73 patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents: 20045
diff changeset
264 s+='E'
5f9c2c7d3d73 patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents: 20045
diff changeset
265 eof
5f9c2c7d3d73 patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents: 20045
diff changeset
266 call assert_equal('ABCDE', pyxeval('s'))
20045
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
267 endfunc
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
268
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
269 " Test for the buffer range object
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
270 func Test_python_range()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
271 new
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
272 call setline(1, ['one', 'two', 'three'])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
273 py b = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
274 py r = b.range(1, 3)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
275 call assert_equal(0, pyeval('r.start'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
276 call assert_equal(2, pyeval('r.end'))
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
277 call assert_equal('one', pyeval('r[0]'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
278 call assert_equal('one', pyeval('r[-3]'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
279 call assert_equal('three', pyeval('r[-4]'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
280 call assert_equal(['two', 'three'], pyeval('r[1:]'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
281 py r[0] = 'green'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
282 call assert_equal(['green', 'two', 'three'], getline(1, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
283 py r[0:2] = ['red', 'blue']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
284 call assert_equal(['red', 'blue', 'three'], getline(1, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
285 call assert_equal(['start', 'end', '__members__'], pyeval('r.__members__'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
286
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
287 " try different invalid start/end index for the range slice
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
288 %d
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
289 call setline(1, ['one', 'two', 'three'])
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
290 py r[-10:1] = ["a"]
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
291 py r[10:12] = ["b"]
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
292 py r[-10:-9] = ["c"]
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
293 py r[1:0] = ["d"]
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
294 call assert_equal(['c', 'd', 'a', 'two', 'three', 'b'], getline(1, '$'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
295
21198
8531ddd7dd63 patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents: 21190
diff changeset
296 " The following code used to trigger an ml_get error
8531ddd7dd63 patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents: 21190
diff changeset
297 %d
8531ddd7dd63 patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents: 21190
diff changeset
298 let x = pyeval('r[:]')
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
299
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
300 " Non-existing range attribute
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
301 call AssertException(["let x = pyeval('r.abc')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
302 \ 'Vim(let):AttributeError: abc')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
303
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
304 close!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
305 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
306
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
307 " Test for the python tabpage object
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
308 func Test_python_tabpage()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
309 tabnew
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
310 py t = vim.tabpages[1]
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
311 py wl = t.windows
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
312 tabclose
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
313 " Accessing a closed tabpage
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
314 call AssertException(["let n = pyeval('t.number')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
315 \ 'Vim(let):vim.error: attempt to refer to deleted tab page')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
316 call AssertException(["let n = pyeval('len(wl)')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
317 \ 'Vim(let):vim.error: attempt to refer to deleted tab page')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
318 call AssertException(["py w = wl[0]"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
319 \ 'Vim(python):vim.error: attempt to refer to deleted tab page')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
320 call AssertException(["py vim.current.tabpage = t"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
321 \ 'Vim(python):vim.error: attempt to refer to deleted tab page')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
322 call assert_match('<tabpage object (deleted)', pyeval('repr(t)'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
323 %bw!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
324 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
325
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
326 " Test for the python window object
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
327 func Test_python_window()
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
328 " Test for setting the window height
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
329 10new
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
330 py vim.current.window.height = 5
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
331 call assert_equal(5, winheight(0))
24685
04205b7d67d5 patch 8.2.2881: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24667
diff changeset
332 py vim.current.window.height = 3.2
04205b7d67d5 patch 8.2.2881: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24667
diff changeset
333 call assert_equal(3, winheight(0))
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
334
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
335 " Test for setting the window width
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
336 10vnew
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
337 py vim.current.window.width = 6
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
338 call assert_equal(6, winwidth(0))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
339
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
340 " Try accessing a closed window
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
341 py w = vim.current.window
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
342 py wopts = w.options
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
343 close
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
344 " Access the attributes of a closed window
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
345 call AssertException(["let n = pyeval('w.number')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
346 \ 'Vim(let):vim.error: attempt to refer to deleted window')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
347 call AssertException(["py w.height = 5"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
348 \ 'Vim(python):vim.error: attempt to refer to deleted window')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
349 call AssertException(["py vim.current.window = w"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
350 \ 'Vim(python):vim.error: attempt to refer to deleted window')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
351 " Try to set one of the options of the closed window
21198
8531ddd7dd63 patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents: 21190
diff changeset
352 " The following caused an ASAN failure
8531ddd7dd63 patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents: 21190
diff changeset
353 call AssertException(["py wopts['list'] = False"],
8531ddd7dd63 patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents: 21190
diff changeset
354 \ 'vim.error: attempt to refer to deleted window')
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
355 call assert_match('<window object (deleted)', pyeval("repr(w)"))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
356 %bw!
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
357 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
358
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
359 " Test for the python List object
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
360 func Test_python_list()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
361 let l = [1, 2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
362 py pl = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
363 call assert_equal(['locked', '__members__'], pyeval('pl.__members__'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
364
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
365 " Try to convert a null List
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
366 call AssertException(["py t = vim.eval('test_null_list()')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
367 \ 'Vim(python):SystemError: error return without exception set')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
368
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
369 " Try to convert a List with a null List item
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
370 call AssertException(["py t = vim.eval('[test_null_list()]')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
371 \ 'Vim(python):SystemError: error return without exception set')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
372
22806
690b84a6a7ce patch 8.2.1951: test for list and dict fails
Bram Moolenaar <Bram@vim.org>
parents: 22011
diff changeset
373 " Try to bind a null List variable (works because an empty list is used)
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
374 let cmds =<< trim END
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
375 let l = test_null_list()
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
376 py ll = vim.bindeval('l')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
377 END
22806
690b84a6a7ce patch 8.2.1951: test for list and dict fails
Bram Moolenaar <Bram@vim.org>
parents: 22011
diff changeset
378 call AssertException(cmds, '')
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
379
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
380 let l = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
381 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
382 py f = vim.bindeval('function("strlen")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
383 " Extending List directly with different types
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
384 py l.extend([1, "as'd", [1, 2, f, {'a': 1}]])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
385 call assert_equal([1, "as'd", [1, 2, function("strlen"), {'a': 1}]], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
386 call assert_equal([1, 2, function("strlen"), {'a': 1}], l[-1])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
387 call assert_fails('echo l[-4]', 'E684:')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
388
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
389 " List assignment
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
390 py l[0] = 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
391 call assert_equal([0, "as'd", [1, 2, function("strlen"), {'a': 1}]], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
392 py l[-2] = f
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
393 call assert_equal([0, function("strlen"), [1, 2, function("strlen"), {'a': 1}]], l)
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
394
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
395 " appending to a list
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
396 let l = [1, 2]
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
397 py ll = vim.bindeval('l')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
398 py ll[2] = 8
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
399 call assert_equal([1, 2, 8], l)
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
400
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
401 " Using dict as an index
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
402 call AssertException(['py ll[{}] = 10'],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
403 \ 'Vim(python):TypeError: index must be int or slice, not dict')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
404 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
405
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
406 " Test for the python Dict object
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
407 func Test_python_dict()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
408 let d = {}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
409 py pd = vim.bindeval('d')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
410 call assert_equal(['locked', 'scope', '__members__'],
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
411 \ pyeval('pd.__members__'))
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
412
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
413 " Try to convert a null Dict
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
414 call AssertException(["py t = vim.eval('test_null_dict()')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
415 \ 'Vim(python):SystemError: error return without exception set')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
416
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
417 " Try to convert a Dict with a null List value
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
418 call AssertException(["py t = vim.eval(\"{'a' : test_null_list()}\")"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
419 \ 'Vim(python):SystemError: error return without exception set')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
420
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
421 " Try to convert a Dict with a null string key
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
422 py t = vim.eval("{test_null_string() : 10}")
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
423 call assert_fails("let d = pyeval('t')", 'E859:')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
424
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
425 " Dict length
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
426 let d = {'a' : 10, 'b' : 20}
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
427 py d = vim.bindeval('d')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
428 call assert_equal(2, pyeval('len(d)'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
429
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 24685
diff changeset
430 " Deleting a non-existing key
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
431 call AssertException(["py del d['c']"], "Vim(python):KeyError: 'c'")
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
432 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
433
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
434 " Extending Dictionary directly with different types
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
435 func Test_python_dict_extend()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
436 let d = {}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
437 func d.f()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
438 return 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
439 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
440
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
441 py f = vim.bindeval('function("strlen")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
442 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
443 d = vim.bindeval('d')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
444 d['1'] = 'asd'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
445 d.update() # Must not do anything, including throwing errors
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
446 d.update(b = [1, 2, f])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
447 d.update((('-1', {'a': 1}),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
448 d.update({'0': -1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
449 dk = d.keys()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
450 dv = d.values()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
451 di = d.items()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
452 cmpfun = lambda a, b: cmp(repr(a), repr(b))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
453 dk.sort(cmpfun)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
454 dv.sort(cmpfun)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
455 di.sort(cmpfun)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
456 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
457
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
458 " Try extending a locked dictionary
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
459 lockvar d
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
460 call AssertException(["py d.update({'b' : 20})"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
461 \ 'Vim(python):vim.error: dictionary is locked')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
462 unlockvar d
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
463
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
464 call assert_equal(1, pyeval("d['f'](self={})"))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
465 call assert_equal("['-1', '0', '1', 'b', 'f']", pyeval('repr(dk)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
466 call assert_equal("['asd', -1L, <vim.Function '1'>, <vim.dictionary object at >, <vim.list object at >]", substitute(pyeval('repr(dv)'),'0x\x\+','','g'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
467 call assert_equal("[('-1', <vim.dictionary object at >), ('0', -1L), ('1', 'asd'), ('b', <vim.list object at >), ('f', <vim.Function '1'>)]", substitute(pyeval('repr(di)'),'0x\x\+','','g'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
468 call assert_equal(['0', '1', 'b', 'f', '-1'], keys(d))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
469 call assert_equal("[-1, 'asd', [1, 2, function('strlen')], function('1'), {'a': 1}]", string(values(d)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
470 py del dk
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
471 py del di
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
472 py del dv
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
473 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
474
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
475 func Test_python_list_del_items()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
476 " removing items with del
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
477 let l = [0, function("strlen"), [1, 2, function("strlen"), {'a': 1}]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
478 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
479 py del l[2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
480 call assert_equal("[0, function('strlen')]", string(l))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
481
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
482 let l = range(8)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
483 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
484 py del l[:3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
485 py del l[1:]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
486 call assert_equal([3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
487
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
488 " removing items out of range: silently skip items that don't exist
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
489
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
490 " The following two ranges delete nothing as they match empty list:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
491 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
492 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
493 py del l[2:1]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
494 call assert_equal([0, 1, 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
495 py del l[2:2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
496 call assert_equal([0, 1, 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
497 py del l[2:3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
498 call assert_equal([0, 1, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
499
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
500 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
501 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
502 py del l[2:4]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
503 call assert_equal([0, 1], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
504
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
505 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
506 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
507 py del l[2:5]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
508 call assert_equal([0, 1], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
509
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
510 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
511 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
512 py del l[2:6]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
513 call assert_equal([0, 1], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
514
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
515 " The following two ranges delete nothing as they match empty list:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
516 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
517 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
518 py del l[-1:2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
519 call assert_equal([0, 1, 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
520 py del l[-2:2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
521 call assert_equal([0, 1, 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
522 py del l[-3:2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
523 call assert_equal([0, 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
524
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
525 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
526 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
527 py del l[-4:2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
528 call assert_equal([2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
529
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
530 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
531 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
532 py del l[-5:2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
533 call assert_equal([2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
534
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
535 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
536 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
537 py del l[-6:2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
538 call assert_equal([2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
539
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
540 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
541 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
542 py del l[::2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
543 call assert_equal([1, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
544
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
545 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
546 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
547 py del l[3:0:-2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
548 call assert_equal([0, 2], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
549
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
550 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
551 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
552 py del l[2:4:-2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
553 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
554 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
555
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
556 func Test_python_dict_del_items()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
557 let d = eval("{'0' : -1, '1' : 'asd', 'b' : [1, 2, function('strlen')], 'f' : function('min'), '-1' : {'a': 1}}")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
558 py d = vim.bindeval('d')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
559 py del d['-1']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
560 py del d['f']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
561 call assert_equal([1, 2, function('strlen')], pyeval('d.get(''b'', 1)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
562 call assert_equal([1, 2, function('strlen')], pyeval('d.pop(''b'')'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
563 call assert_equal(1, pyeval('d.get(''b'', 1)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
564 call assert_equal('asd', pyeval('d.pop(''1'', 2)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
565 call assert_equal(2, pyeval('d.pop(''1'', 2)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
566 call assert_equal('True', pyeval('repr(d.has_key(''0''))'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
567 call assert_equal('False', pyeval('repr(d.has_key(''1''))'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
568 call assert_equal('True', pyeval('repr(''0'' in d)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
569 call assert_equal('False', pyeval('repr(''1'' in d)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
570 call assert_equal("['0']", pyeval('repr(list(iter(d)))'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
571 call assert_equal({'0' : -1}, d)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
572 call assert_equal("('0', -1L)", pyeval('repr(d.popitem())'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
573 call assert_equal('None', pyeval('repr(d.get(''0''))'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
574 call assert_equal('[]', pyeval('repr(list(iter(d)))'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
575 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
576
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
577 " Slice assignment to a list
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
578 func Test_python_slice_assignment()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
579 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
580 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
581 py l[0:0] = ['a']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
582 call assert_equal(['a', 0, 1, 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
583
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
584 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
585 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
586 py l[1:2] = ['b']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
587 call assert_equal([0, 'b', 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
588
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
589 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
590 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
591 py l[2:4] = ['c']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
592 call assert_equal([0, 1, 'c'], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
593
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
594 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
595 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
596 py l[4:4] = ['d']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
597 call assert_equal([0, 1, 2, 3, 'd'], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
598
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
599 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
600 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
601 py l[-1:2] = ['e']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
602 call assert_equal([0, 1, 2, 'e', 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
603
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
604 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
605 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
606 py l[-10:2] = ['f']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
607 call assert_equal(['f', 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
608
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
609 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
610 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
611 py l[2:-10] = ['g']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
612 call assert_equal([0, 1, 'g', 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
613
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
614 let l = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
615 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
616 py l[0:0] = ['h']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
617 call assert_equal(['h'], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
618
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
619 let l = range(8)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
620 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
621 py l[2:6:2] = [10, 20]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
622 call assert_equal([0, 1, 10, 3, 20, 5, 6, 7], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
623
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
624 let l = range(8)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
625 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
626 py l[6:2:-2] = [10, 20]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
627 call assert_equal([0, 1, 2, 3, 20, 5, 10, 7], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
628
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
629 let l = range(8)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
630 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
631 py l[6:2] = ()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
632 call assert_equal([0, 1, 2, 3, 4, 5, 6, 7], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
633
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
634 let l = range(8)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
635 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
636 py l[6:2:1] = ()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
637 call assert_equal([0, 1, 2, 3, 4, 5, 6, 7], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
638
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
639 let l = range(8)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
640 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
641 py l[2:2:1] = ()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
642 call assert_equal([0, 1, 2, 3, 4, 5, 6, 7], l)
21200
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
643
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
644 call AssertException(["py x = l[10:11:0]"],
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
645 \ "Vim(python):ValueError: slice step cannot be zero")
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
646 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
647
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
648 " Locked variables
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
649 func Test_python_lockedvar()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
650 new
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
651 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
652 let l = [0, 1, 2, 3]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
653 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
654 lockvar! l
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
655 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
656 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
657 l[2]='i'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
658 except vim.error:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
659 cb.append('l[2] threw vim.error: ' + emsg(sys.exc_info()))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
660 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
661 call assert_equal(['', "l[2] threw vim.error: error:('list is locked',)"],
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
662 \ getline(1, '$'))
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
663
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
664 " Try to concatenate a locked list
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
665 call AssertException(['py l += [4, 5]'],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
666 \ 'Vim(python):vim.error: list is locked')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
667
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
668 call assert_equal([0, 1, 2, 3], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
669 unlockvar! l
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
670 close!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
671 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
672
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
673 " Test for calling a function
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
674 func Test_python_function_call()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
675 func New(...)
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
676 return ['NewStart'] + a:000 + ['NewEnd']
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
677 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
678
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
679 func DictNew(...) dict
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
680 return ['DictNewStart'] + a:000 + ['DictNewEnd', self]
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
681 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
682
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
683 new
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
684 let l = [function('New'), function('DictNew')]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
685 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
686 py l.extend(list(l[0](1, 2, 3)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
687 call assert_equal([function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd'], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
688 py l.extend(list(l[1](1, 2, 3, self={'a': 'b'})))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
689 call assert_equal([function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
690 py l.extend([l[0].name])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
691 call assert_equal([function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}, 'New'], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
692 py ee('l[1](1, 2, 3)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
693 call assert_equal("l[1](1, 2, 3):error:('Vim:E725: Calling dict function without Dictionary: DictNew',)", getline(2))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
694 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
695 py f = l[0]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
696 delfunction New
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
697 py ee('f(1, 2, 3)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
698 call assert_equal("f(1, 2, 3):error:('Vim:E117: Unknown function: New',)", getline(2))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
699 close!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
700 delfunction DictNew
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
701 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
702
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
703 func Test_python_float()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
704 let l = [0.0]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
705 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
706 py l.extend([0.0])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
707 call assert_equal([0.0, 0.0], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
708 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
709
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
710 " Test for Dict key errors
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
711 func Test_python_dict_key_error()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
712 let messages = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
713 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
714 d = vim.bindeval('{}')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
715 m = vim.bindeval('messages')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
716 def em(expr, g=globals(), l=locals()):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
717 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
718 exec(expr, g, l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
719 except:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
720 m.extend([sys.exc_type.__name__])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
721
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
722 em('d["abc1"]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
723 em('d["abc1"]="\\0"')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
724 em('d["abc1"]=vim')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
725 em('d[""]=1')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
726 em('d["a\\0b"]=1')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
727 em('d[u"a\\0b"]=1')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
728 em('d.pop("abc1")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
729 em('d.popitem()')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
730 del em
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
731 del m
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
732 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
733
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
734 call assert_equal(['KeyError', 'TypeError', 'TypeError', 'ValueError',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
735 \ 'TypeError', 'TypeError', 'KeyError', 'KeyError'], messages)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
736 unlet messages
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
737 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
738
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
739 " Test for locked and scope attributes
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
740 func Test_python_lock_scope_attr()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
741 let d = {} | let dl = {} | lockvar dl
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
742 let res = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
743 for s in split("d dl v: g:")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
744 let name = tr(s, ':', 's')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
745 execute 'py ' .. name .. ' = vim.bindeval("' .. s .. '")'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
746 call add(res, s .. ' : ' .. join(map(['locked', 'scope'],
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
747 \ 'v:val .. ":" .. pyeval(name .. "." .. v:val)'), ';'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
748 endfor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
749 call assert_equal(['d : locked:0;scope:0', 'dl : locked:1;scope:0',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
750 \ 'v: : locked:2;scope:1', 'g: : locked:0;scope:2'], res)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
751
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
752 silent! let d.abc2 = 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
753 silent! let dl.abc3 = 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
754 py d.locked = True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
755 py dl.locked = False
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
756 silent! let d.def = 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
757 silent! let dl.def = 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
758 call assert_equal({'abc2': 1}, d)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
759 call assert_equal({'def': 1}, dl)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
760 unlet d dl
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
761
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
762 let l = [] | let ll = [] | lockvar ll
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
763 let res = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
764 for s in split("l ll")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
765 let name = tr(s, ':', 's')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
766 execute 'py ' .. name .. '=vim.bindeval("' .. s .. '")'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
767 call add(res, s .. ' : locked:' .. pyeval(name .. '.locked'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
768 endfor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
769 call assert_equal(['l : locked:0', 'll : locked:1'], res)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
770
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
771 silent! call extend(l, [0])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
772 silent! call extend(ll, [0])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
773 py l.locked = True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
774 py ll.locked = False
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
775 silent! call extend(l, [1])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
776 silent! call extend(ll, [1])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
777 call assert_equal([0], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
778 call assert_equal([1], ll)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
779 unlet l ll
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
780
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
781 " Try changing an attribute of a fixed list
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
782 py a = vim.bindeval('v:argv')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
783 call AssertException(['py a.locked = 0'],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
784 \ 'Vim(python):TypeError: cannot modify fixed list')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
785 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
786
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
787 " Test for pyeval()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
788 func Test_python_pyeval()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
789 let l = pyeval('range(3)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
790 call assert_equal([0, 1, 2], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
791
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
792 let d = pyeval('{"a": "b", "c": 1, "d": ["e"]}')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
793 call assert_equal([['a', 'b'], ['c', 1], ['d', ['e']]], sort(items(d)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
794
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
795 let v:errmsg = ''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
796 call assert_equal(v:none, pyeval('None'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
797 call assert_equal('', v:errmsg)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
798
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
799 py v = vim.eval('test_null_function()')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
800 call assert_equal(v:none, pyeval('v'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
801
30310
029c59bf78f1 patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
802 call assert_equal(0.0, pyeval('0.0'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
803
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
804 " Evaluate an invalid values
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
805 call AssertException(['let v = pyeval(''"\0"'')'], 'E859:')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
806 call AssertException(['let v = pyeval(''{"\0" : 1}'')'], 'E859:')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
807 call AssertException(['let v = pyeval("undefined_name")'],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
808 \ "Vim(let):NameError: name 'undefined_name' is not defined")
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
809 call AssertException(['let v = pyeval("vim")'], 'E859:')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
810 endfunc
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
811
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
812 " Test for vim.bindeval()
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
813 func Test_python_vim_bindeval()
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
814 " Float
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
815 let f = 3.14
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
816 py f = vim.bindeval('f')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
817 call assert_equal(3.14, pyeval('f'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
818
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
819 " Blob
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
820 let b = 0z12
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
821 py b = vim.bindeval('b')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
822 call assert_equal("\x12", pyeval('b'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
823
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
824 " Bool
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
825 call assert_equal(1, pyeval("vim.bindeval('v:true')"))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
826 call assert_equal(0, pyeval("vim.bindeval('v:false')"))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
827 call assert_equal(v:none, pyeval("vim.bindeval('v:null')"))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
828 call assert_equal(v:none, pyeval("vim.bindeval('v:none')"))
21200
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
829
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
830 " channel/job
24667
8feb0450b690 patch 8.2.2872: Python tests fail without the channel feature
Bram Moolenaar <Bram@vim.org>
parents: 23264
diff changeset
831 if has('channel')
8feb0450b690 patch 8.2.2872: Python tests fail without the channel feature
Bram Moolenaar <Bram@vim.org>
parents: 23264
diff changeset
832 call assert_equal(v:none, pyeval("vim.bindeval('test_null_channel()')"))
8feb0450b690 patch 8.2.2872: Python tests fail without the channel feature
Bram Moolenaar <Bram@vim.org>
parents: 23264
diff changeset
833 endif
8feb0450b690 patch 8.2.2872: Python tests fail without the channel feature
Bram Moolenaar <Bram@vim.org>
parents: 23264
diff changeset
834 if has('job')
8feb0450b690 patch 8.2.2872: Python tests fail without the channel feature
Bram Moolenaar <Bram@vim.org>
parents: 23264
diff changeset
835 call assert_equal(v:none, pyeval("vim.bindeval('test_null_job()')"))
8feb0450b690 patch 8.2.2872: Python tests fail without the channel feature
Bram Moolenaar <Bram@vim.org>
parents: 23264
diff changeset
836 endif
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
837 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
838
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
839 " threading
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
840 " Running pydo command (Test_pydo) before this test, stops the python thread
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
841 " from running. So this test should be run before the pydo test
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
842 func Test_aaa_python_threading()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
843 let l = [0]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
844 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
845 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
846 import threading
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
847 import time
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
848
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
849 class T(threading.Thread):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
850 def __init__(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
851 threading.Thread.__init__(self)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
852 self.t = 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
853 self.running = True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
854
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
855 def run(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
856 while self.running:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
857 self.t += 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
858 time.sleep(0.1)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
859
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
860 t = T()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
861 del T
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
862 t.start()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
863 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
864
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
865 sleep 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
866 py t.running = False
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
867 py t.join()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
868
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
869 " Check if the background thread is working. Count should be 10, but on a
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
870 " busy system (AppVeyor) it can be much lower.
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
871 py l[0] = t.t > 4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
872 py del time
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
873 py del threading
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
874 py del t
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
875 call assert_equal([1], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
876 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
877
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
878 " settrace
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
879 func Test_python_settrace()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
880 let l = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
881 py l = vim.bindeval('l')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
882 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
883 import sys
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
884
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
885 def traceit(frame, event, arg):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
886 global l
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
887 if event == "line":
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
888 l.extend([frame.f_lineno])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
889 return traceit
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
890
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
891 def trace_main():
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
892 for i in range(5):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
893 pass
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
894 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
895 py sys.settrace(traceit)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
896 py trace_main()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
897 py sys.settrace(None)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
898 py del traceit
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
899 py del trace_main
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
900 call assert_equal([1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1], l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
901 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
902
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
903 " Slice
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
904 func Test_python_list_slice()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
905 py ll = vim.bindeval('[0, 1, 2, 3, 4, 5]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
906 py l = ll[:4]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
907 call assert_equal([0, 1, 2, 3], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
908 py l = ll[2:]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
909 call assert_equal([2, 3, 4, 5], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
910 py l = ll[:-4]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
911 call assert_equal([0, 1], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
912 py l = ll[-2:]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
913 call assert_equal([4, 5], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
914 py l = ll[2:4]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
915 call assert_equal([2, 3], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
916 py l = ll[4:2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
917 call assert_equal([], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
918 py l = ll[-4:-2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
919 call assert_equal([2, 3], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
920 py l = ll[-2:-4]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
921 call assert_equal([], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
922 py l = ll[:]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
923 call assert_equal([0, 1, 2, 3, 4, 5], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
924 py l = ll[0:6]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
925 call assert_equal([0, 1, 2, 3, 4, 5], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
926 py l = ll[-10:10]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
927 call assert_equal([0, 1, 2, 3, 4, 5], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
928 py l = ll[4:2:-1]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
929 call assert_equal([4, 3], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
930 py l = ll[::2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
931 call assert_equal([0, 2, 4], pyeval('l'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
932 py l = ll[4:2:1]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
933 call assert_equal([], pyeval('l'))
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
934
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
935 " Error case: Use an invalid index
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
936 call AssertException(['py ll[-10] = 5'], 'Vim(python):vim.error: internal error:')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
937
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
938 " Use a step value of 0
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
939 call AssertException(['py ll[0:3:0] = [1, 2, 3]'],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
940 \ 'Vim(python):ValueError: slice step cannot be zero')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
941
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
942 " Error case: Invalid slice type
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
943 call AssertException(["py x = ll['abc']"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
944 \ 'Vim(python):TypeError: index must be int or slice, not str')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
945 py del l
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
946
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
947 " Error case: List with a null list item
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
948 let l = [test_null_list()]
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
949 py ll = vim.bindeval('l')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
950 call AssertException(["py x = ll[:]"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
951 \ 'Vim(python):SystemError: error return without exception set')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
952 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
953
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
954 " Vars
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
955 func Test_python_vars()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
956 let g:foo = 'bac'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
957 let w:abc3 = 'def'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
958 let b:baz = 'bar'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
959 let t:bar = 'jkl'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
960 try
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
961 throw "Abc"
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
962 catch /Abc/
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
963 call assert_equal('Abc', pyeval('vim.vvars[''exception'']'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
964 endtry
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
965 call assert_equal('bac', pyeval('vim.vars[''foo'']'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
966 call assert_equal('def', pyeval('vim.current.window.vars[''abc3'']'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
967 call assert_equal('bar', pyeval('vim.current.buffer.vars[''baz'']'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
968 call assert_equal('jkl', pyeval('vim.current.tabpage.vars[''bar'']'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
969 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
970
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
971 " Options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
972 " paste: boolean, global
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
973 " previewheight number, global
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
974 " operatorfunc: string, global
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
975 " number: boolean, window-local
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
976 " numberwidth: number, window-local
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
977 " colorcolumn: string, window-local
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
978 " statusline: string, window-local/global
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
979 " autoindent: boolean, buffer-local
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
980 " shiftwidth: number, buffer-local
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
981 " omnifunc: string, buffer-local
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
982 " preserveindent: boolean, buffer-local/global
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
983 " path: string, buffer-local/global
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
984 func Test_python_opts()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
985 let g:res = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
986 let g:bufs = [bufnr('%')]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
987 new
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
988 let g:bufs += [bufnr('%')]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
989 vnew
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
990 let g:bufs += [bufnr('%')]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
991 wincmd j
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
992 vnew
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
993 let g:bufs += [bufnr('%')]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
994 wincmd l
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
995
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
996 func RecVars(opt)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
997 let gval = string(eval('&g:' .. a:opt))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
998 let wvals = join(map(range(1, 4),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
999 \ 'v:val .. ":" .. string(getwinvar(v:val, "&" .. a:opt))'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1000 let bvals = join(map(copy(g:bufs),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1001 \ 'v:val .. ":" .. string(getbufvar(v:val, "&" .. a:opt))'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1002 call add(g:res, ' G: ' .. gval)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1003 call add(g:res, ' W: ' .. wvals)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1004 call add(g:res, ' B: ' .. wvals)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1005 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1006
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1007 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1008 def e(s, g=globals(), l=locals()):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1009 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1010 exec(s, g, l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1011 except:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1012 vim.command('return ' + repr(sys.exc_type.__name__))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1013
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1014 def ev(s, g=globals(), l=locals()):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1015 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1016 return eval(s, g, l)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1017 except:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1018 vim.command('let exc=' + repr(sys.exc_type.__name__))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1019 return 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1020 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1021
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1022 func E(s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1023 python e(vim.eval('a:s'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1024 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1025
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1026 func Ev(s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1027 let r = pyeval('ev(vim.eval("a:s"))')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1028 if exists('exc')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1029 throw exc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1030 endif
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1031 return r
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1032 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1033
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1034 py gopts1 = vim.options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1035 py wopts1 = vim.windows[2].options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1036 py wopts2 = vim.windows[0].options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1037 py wopts3 = vim.windows[1].options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1038 py bopts1 = vim.buffers[vim.bindeval("g:bufs")[2]].options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1039 py bopts2 = vim.buffers[vim.bindeval("g:bufs")[1]].options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1040 py bopts3 = vim.buffers[vim.bindeval("g:bufs")[0]].options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1041 call add(g:res, 'wopts iters equal: ' ..
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1042 \ pyeval('list(wopts1) == list(wopts2)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1043 call add(g:res, 'bopts iters equal: ' ..
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1044 \ pyeval('list(bopts1) == list(bopts2)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1045 py gset = set(iter(gopts1))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1046 py wset = set(iter(wopts1))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1047 py bset = set(iter(bopts1))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1048
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1049 set path=.,..,,
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1050 let lst = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1051 let lst += [['paste', 1, 0, 1, 2, 1, 1, 0]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1052 let lst += [['previewheight', 5, 1, 6, 'a', 0, 1, 0]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1053 let lst += [['operatorfunc', 'A', 'B', 'C', 2, 0, 1, 0]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1054 let lst += [['number', 0, 1, 1, 0, 1, 0, 1]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1055 let lst += [['numberwidth', 2, 3, 5, -100, 0, 0, 1]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1056 let lst += [['colorcolumn', '+1', '+2', '+3', 'abc4', 0, 0, 1]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1057 let lst += [['statusline', '1', '2', '4', 0, 0, 1, 1]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1058 let lst += [['autoindent', 0, 1, 1, 2, 1, 0, 2]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1059 let lst += [['shiftwidth', 0, 2, 1, 3, 0, 0, 2]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1060 let lst += [['omnifunc', 'A', 'B', 'C', 1, 0, 0, 2]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1061 let lst += [['preserveindent', 0, 1, 1, 2, 1, 1, 2]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1062 let lst += [['path', '.,,', ',,', '.', 0, 0, 1, 2]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1063 for [oname, oval1, oval2, oval3, invval, bool, global, local] in lst
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1064 py oname = vim.eval('oname')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1065 py oval1 = vim.bindeval('oval1')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1066 py oval2 = vim.bindeval('oval2')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1067 py oval3 = vim.bindeval('oval3')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1068 if invval is 0 || invval is 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1069 py invval = bool(vim.bindeval('invval'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1070 else
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1071 py invval = vim.bindeval('invval')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1072 endif
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1073 if bool
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1074 py oval1 = bool(oval1)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1075 py oval2 = bool(oval2)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1076 py oval3 = bool(oval3)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1077 endif
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1078 call add(g:res, '>>> ' .. oname)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1079 call add(g:res, ' g/w/b:' .. pyeval('oname in gset') .. '/' ..
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1080 \ pyeval('oname in wset') .. '/' .. pyeval('oname in bset'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1081 call add(g:res, ' g/w/b (in):' .. pyeval('oname in gopts1') .. '/' ..
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1082 \ pyeval('oname in wopts1') .. '/' .. pyeval('oname in bopts1'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1083 for v in ['gopts1', 'wopts1', 'bopts1']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1084 try
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1085 call add(g:res, ' p/' .. v .. ': ' .. Ev('repr(' .. v .. '[''' .. oname .. '''])'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1086 catch
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1087 call add(g:res, ' p/' .. v .. '! ' .. v:exception)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1088 endtry
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1089 let r = E(v .. '[''' .. oname .. ''']=invval')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1090 if r isnot 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1091 call add(g:res, ' inv: ' .. string(invval) .. '! ' .. r)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1092 endif
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1093 for vv in (v is# 'gopts1' ? [v] : [v, v[:-2] .. '2', v[:-2] .. '3'])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1094 let val = substitute(vv, '^.opts', 'oval', '')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1095 let r = E(vv .. '[''' .. oname .. ''']=' .. val)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1096 if r isnot 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1097 call add(g:res, ' ' .. vv .. '! ' .. r)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1098 endif
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1099 endfor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1100 endfor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1101 call RecVars(oname)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1102 for v in ['wopts3', 'bopts3']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1103 let r = E('del ' .. v .. '["' .. oname .. '"]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1104 if r isnot 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1105 call add(g:res, ' del ' .. v .. '! ' .. r)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1106 endif
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1107 endfor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1108 call RecVars(oname)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1109 endfor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1110 delfunction RecVars
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1111 delfunction E
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1112 delfunction Ev
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1113 py del ev
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1114 py del e
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1115 only
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1116 for buf in g:bufs[1:]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1117 execute 'bwipeout!' buf
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1118 endfor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1119 py del gopts1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1120 py del wopts1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1121 py del wopts2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1122 py del wopts3
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1123 py del bopts1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1124 py del bopts2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1125 py del bopts3
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1126 py del oval1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1127 py del oval2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1128 py del oval3
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1129 py del oname
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1130 py del invval
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1131
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1132 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1133 wopts iters equal: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1134 bopts iters equal: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1135 >>> paste
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1136 g/w/b:1/0/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1137 g/w/b (in):1/0/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1138 p/gopts1: False
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1139 p/wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1140 inv: 2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1141 wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1142 wopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1143 wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1144 p/bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1145 inv: 2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1146 bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1147 bopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1148 bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1149 G: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1150 W: 1:1 2:1 3:1 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1151 B: 1:1 2:1 3:1 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1152 del wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1153 del bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1154 G: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1155 W: 1:1 2:1 3:1 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1156 B: 1:1 2:1 3:1 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1157 >>> previewheight
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1158 g/w/b:1/0/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1159 g/w/b (in):1/0/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1160 p/gopts1: 12
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1161 inv: 'a'! TypeError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1162 p/wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1163 inv: 'a'! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1164 wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1165 wopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1166 wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1167 p/bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1168 inv: 'a'! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1169 bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1170 bopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1171 bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1172 G: 5
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1173 W: 1:5 2:5 3:5 4:5
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1174 B: 1:5 2:5 3:5 4:5
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1175 del wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1176 del bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1177 G: 5
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1178 W: 1:5 2:5 3:5 4:5
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1179 B: 1:5 2:5 3:5 4:5
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1180 >>> operatorfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1181 g/w/b:1/0/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1182 g/w/b (in):1/0/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1183 p/gopts1: ''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1184 inv: 2! TypeError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1185 p/wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1186 inv: 2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1187 wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1188 wopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1189 wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1190 p/bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1191 inv: 2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1192 bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1193 bopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1194 bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1195 G: 'A'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1196 W: 1:'A' 2:'A' 3:'A' 4:'A'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1197 B: 1:'A' 2:'A' 3:'A' 4:'A'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1198 del wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1199 del bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1200 G: 'A'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1201 W: 1:'A' 2:'A' 3:'A' 4:'A'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1202 B: 1:'A' 2:'A' 3:'A' 4:'A'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1203 >>> number
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1204 g/w/b:0/1/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1205 g/w/b (in):0/1/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1206 p/gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1207 inv: 0! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1208 gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1209 p/wopts1: False
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1210 p/bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1211 inv: 0! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1212 bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1213 bopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1214 bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1215 G: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1216 W: 1:1 2:1 3:0 4:0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1217 B: 1:1 2:1 3:0 4:0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1218 del wopts3! ValueError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1219 del bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1220 G: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1221 W: 1:1 2:1 3:0 4:0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1222 B: 1:1 2:1 3:0 4:0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1223 >>> numberwidth
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1224 g/w/b:0/1/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1225 g/w/b (in):0/1/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1226 p/gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1227 inv: -100! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1228 gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1229 p/wopts1: 4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1230 inv: -100! error
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1231 p/bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1232 inv: -100! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1233 bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1234 bopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1235 bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1236 G: 4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1237 W: 1:3 2:5 3:2 4:4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1238 B: 1:3 2:5 3:2 4:4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1239 del wopts3! ValueError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1240 del bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1241 G: 4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1242 W: 1:3 2:5 3:2 4:4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1243 B: 1:3 2:5 3:2 4:4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1244 >>> colorcolumn
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1245 g/w/b:0/1/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1246 g/w/b (in):0/1/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1247 p/gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1248 inv: 'abc4'! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1249 gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1250 p/wopts1: ''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1251 inv: 'abc4'! error
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1252 p/bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1253 inv: 'abc4'! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1254 bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1255 bopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1256 bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1257 G: ''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1258 W: 1:'+2' 2:'+3' 3:'+1' 4:''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1259 B: 1:'+2' 2:'+3' 3:'+1' 4:''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1260 del wopts3! ValueError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1261 del bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1262 G: ''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1263 W: 1:'+2' 2:'+3' 3:'+1' 4:''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1264 B: 1:'+2' 2:'+3' 3:'+1' 4:''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1265 >>> statusline
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1266 g/w/b:1/1/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1267 g/w/b (in):1/1/0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1268 p/gopts1: ''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1269 inv: 0! TypeError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1270 p/wopts1: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1271 inv: 0! TypeError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1272 p/bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1273 inv: 0! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1274 bopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1275 bopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1276 bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1277 G: '1'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1278 W: 1:'2' 2:'4' 3:'1' 4:'1'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1279 B: 1:'2' 2:'4' 3:'1' 4:'1'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1280 del bopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1281 G: '1'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1282 W: 1:'2' 2:'1' 3:'1' 4:'1'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1283 B: 1:'2' 2:'1' 3:'1' 4:'1'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1284 >>> autoindent
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1285 g/w/b:0/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1286 g/w/b (in):0/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1287 p/gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1288 inv: 2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1289 gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1290 p/wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1291 inv: 2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1292 wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1293 wopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1294 wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1295 p/bopts1: False
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1296 G: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1297 W: 1:0 2:1 3:0 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1298 B: 1:0 2:1 3:0 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1299 del wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1300 del bopts3! ValueError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1301 G: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1302 W: 1:0 2:1 3:0 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1303 B: 1:0 2:1 3:0 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1304 >>> shiftwidth
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1305 g/w/b:0/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1306 g/w/b (in):0/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1307 p/gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1308 inv: 3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1309 gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1310 p/wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1311 inv: 3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1312 wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1313 wopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1314 wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1315 p/bopts1: 8
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1316 G: 8
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1317 W: 1:0 2:2 3:8 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1318 B: 1:0 2:2 3:8 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1319 del wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1320 del bopts3! ValueError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1321 G: 8
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1322 W: 1:0 2:2 3:8 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1323 B: 1:0 2:2 3:8 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1324 >>> omnifunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1325 g/w/b:0/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1326 g/w/b (in):0/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1327 p/gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1328 inv: 1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1329 gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1330 p/wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1331 inv: 1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1332 wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1333 wopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1334 wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1335 p/bopts1: ''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1336 inv: 1! TypeError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1337 G: ''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1338 W: 1:'A' 2:'B' 3:'' 4:'C'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1339 B: 1:'A' 2:'B' 3:'' 4:'C'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1340 del wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1341 del bopts3! ValueError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1342 G: ''
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1343 W: 1:'A' 2:'B' 3:'' 4:'C'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1344 B: 1:'A' 2:'B' 3:'' 4:'C'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1345 >>> preserveindent
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1346 g/w/b:0/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1347 g/w/b (in):0/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1348 p/gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1349 inv: 2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1350 gopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1351 p/wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1352 inv: 2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1353 wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1354 wopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1355 wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1356 p/bopts1: False
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1357 G: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1358 W: 1:0 2:1 3:0 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1359 B: 1:0 2:1 3:0 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1360 del wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1361 del bopts3! ValueError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1362 G: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1363 W: 1:0 2:1 3:0 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1364 B: 1:0 2:1 3:0 4:1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1365 >>> path
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1366 g/w/b:1/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1367 g/w/b (in):1/0/1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1368 p/gopts1: '.,..,,'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1369 inv: 0! TypeError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1370 p/wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1371 inv: 0! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1372 wopts1! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1373 wopts2! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1374 wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1375 p/bopts1: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1376 inv: 0! TypeError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1377 G: '.,,'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1378 W: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1379 B: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1380 del wopts3! KeyError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1381 G: '.,,'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1382 W: 1:'.,,' 2:',,' 3:'.,,' 4:'.,,'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1383 B: 1:'.,,' 2:',,' 3:'.,,' 4:'.,,'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1384 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1385
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1386 call assert_equal(expected, g:res)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1387 unlet g:res
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1388
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1389 call assert_equal(0, pyeval("'' in vim.options"))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1390
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1391 " use an empty key to index vim.options
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1392 call AssertException(["let v = pyeval(\"vim.options['']\")"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1393 \ 'Vim(let):ValueError: empty keys are not allowed')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1394 call AssertException(["py vim.current.window.options[''] = 0"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1395 \ 'Vim(python):ValueError: empty keys are not allowed')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1396 call AssertException(["py vim.current.window.options[{}] = 0"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1397 \ 'Vim(python):TypeError: expected str() or unicode() instance, but got dict')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1398
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1399 " set one of the number options to a very large number
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1400 let cmd = ["py vim.options['previewheight'] = 9999999999999999"]
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1401 call AssertException(cmd, 'OverflowError:')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1402
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1403 " unset a global-local string option
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1404 call AssertException(["py del vim.options['errorformat']"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1405 \ 'Vim(python):ValueError: unable to unset global option errorformat')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1406 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1407
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1408 " Test for vim.buffer object
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1409 func Test_python_buffer()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1410 new
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1411 call setline(1, "Hello\nWorld")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1412 call assert_fails("let x = pyeval('vim.current.buffer[0]')", 'E859:')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1413 %bw!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1414
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1415 edit Xfile1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1416 let bnr1 = bufnr()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1417 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1418 vnew Xfile2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1419 let bnr2 = bufnr()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1420 call setline(1, ['First line', 'Second line', 'Third line'])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1421 py b = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1422 wincmd w
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1423
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1424 " Test for getting lines from the buffer using a slice
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1425 call assert_equal(['First line'], pyeval('b[-10:1]'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1426 call assert_equal(['Third line'], pyeval('b[2:10]'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1427 call assert_equal([], pyeval('b[2:0]'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1428 call assert_equal([], pyeval('b[10:12]'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1429 call assert_equal([], pyeval('b[-10:-8]'))
21200
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1430 call AssertException(["py x = b[0:3:0]"],
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1431 \ "Vim(python):TypeError: sequence index must be integer, not 'slice'")
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1432 call AssertException(["py b[0:3:0] = 'abc'"],
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1433 \ "Vim(python):TypeError: sequence index must be integer, not 'slice'")
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1434 call AssertException(["py x = b[{}]"],
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1435 \ "Vim(python):TypeError: sequence index must be integer, not 'dict'")
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1436 call AssertException(["py b[{}] = 'abc'"],
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1437 \ "Vim(python):TypeError: sequence index must be integer, not 'dict'")
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1438
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1439 " Test for getting lines using a range
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1440 call AssertException(["py x = b.range(0,3)[0:2:0]"],
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1441 \ "Vim(python):TypeError: sequence index must be integer, not 'slice'")
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1442 call AssertException(["py b.range(0,3)[0:2:0] = 'abc'"],
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1443 \ "Vim(python):TypeError: sequence index must be integer, not 'slice'")
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1444
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1445 " Tests BufferAppend and BufferItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1446 py cb.append(b[0])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1447 call assert_equal(['First line'], getbufline(bnr1, 2))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1448 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1449
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1450 " Try to append using out-of-range line number
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1451 call AssertException(["py b.append('abc', 10)"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1452 \ 'Vim(python):IndexError: line number out of range')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1453
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1454 " Append a non-string item
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1455 call AssertException(["py b.append([22])"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1456 \ 'Vim(python):TypeError: expected str() or unicode() instance, but got int')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1457
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1458 " Tests BufferSlice and BufferAssSlice
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1459 py cb.append('abc5') # Will be overwritten
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1460 py cb[-1:] = b[:-2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1461 call assert_equal(['First line'], getbufline(bnr1, 2))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1462 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1463
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1464 " Test BufferLength and BufferAssSlice
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1465 py cb.append('def') # Will not be overwritten
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1466 py cb[len(cb):] = b[:]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1467 call assert_equal(['def', 'First line', 'Second line', 'Third line'],
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1468 \ getbufline(bnr1, 2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1469 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1470
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1471 " Test BufferAssItem and BufferMark
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1472 call setbufline(bnr1, 1, ['one', 'two', 'three'])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1473 call cursor(1, 3)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1474 normal ma
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1475 py cb.append('ghi') # Will be overwritten
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1476 py cb[-1] = repr((len(cb) - cb.mark('a')[0], cb.mark('a')[1]))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1477 call assert_equal(['(3, 2)'], getbufline(bnr1, 4))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1478 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1479
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1480 " Test BufferRepr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1481 py cb.append(repr(cb) + repr(b))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1482 call assert_equal(['<buffer Xfile1><buffer Xfile2>'], getbufline(bnr1, 2))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1483 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1484
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1485 " Modify foreign buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1486 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1487 b.append('foo')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1488 b[0]='bar'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1489 b[0:0]=['baz']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1490 vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1491 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1492 call assert_equal(['baz', 'bar', 'Second line', 'Third line', 'foo'],
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1493 \ getbufline(bnr2, 1, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1494 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1495
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1496 " Test assigning to name property
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1497 augroup BUFS
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
1498 autocmd BufFilePost * python cb.append(vim.eval('expand("<abuf>")') + ':BufFilePost:' + vim.eval('bufnr("%")'))
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
1499 autocmd BufFilePre * python cb.append(vim.eval('expand("<abuf>")') + ':BufFilePre:' + vim.eval('bufnr("%")'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1500 augroup END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1501 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1502 import os
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1503 old_name = cb.name
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1504 cb.name = 'foo'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1505 cb.append(cb.name[-11:].replace(os.path.sep, '/'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1506 b.name = 'bar'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1507 cb.append(b.name[-11:].replace(os.path.sep, '/'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1508 cb.name = old_name
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1509 cb.append(cb.name[-14:].replace(os.path.sep, '/'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1510 del old_name
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1511 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1512 call assert_equal([bnr1 .. ':BufFilePre:' .. bnr1,
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1513 \ bnr1 .. ':BufFilePost:' .. bnr1,
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1514 \ 'testdir/foo',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1515 \ bnr2 .. ':BufFilePre:' .. bnr2,
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1516 \ bnr2 .. ':BufFilePost:' .. bnr2,
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1517 \ 'testdir/bar',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1518 \ bnr1 .. ':BufFilePre:' .. bnr1,
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1519 \ bnr1 .. ':BufFilePost:' .. bnr1,
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1520 \ 'testdir/Xfile1'], getbufline(bnr1, 2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1521 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1522
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1523 " Test CheckBuffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1524 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1525 for _b in vim.buffers:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1526 if _b is not cb:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1527 vim.command('bwipeout! ' + str(_b.number))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1528 del _b
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1529 cb.append('valid: b:%s, cb:%s' % (repr(b.valid), repr(cb.valid)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1530 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1531 call assert_equal('valid: b:False, cb:True', getline(2))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1532 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1533
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1534 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1535 for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc6")', 'b.name = "!"'):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1536 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1537 exec(expr)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1538 except vim.error:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1539 pass
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1540 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1541 # Usually a SEGV here
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1542 # Should not happen in any case
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1543 cb.append('No exception for ' + expr)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1544 vim.command('cd .')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1545 del b
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1546 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1547 call assert_equal([''], getline(1, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1548
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1549 " Delete all the lines in a buffer
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1550 call setline(1, ['a', 'b', 'c'])
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1551 py vim.current.buffer[:] = []
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1552 call assert_equal([''], getline(1, '$'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1553
21200
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1554 " Test for buffer marks
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1555 call assert_equal(v:none, pyeval("vim.current.buffer.mark('r')"))
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
1556
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1557 " Test for modifying a 'nomodifiable' buffer
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1558 setlocal nomodifiable
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1559 call AssertException(["py vim.current.buffer[0] = 'abc'"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1560 \ "Vim(python):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1561 call AssertException(["py vim.current.buffer[0] = None"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1562 \ "Vim(python):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1563 call AssertException(["py vim.current.buffer[:] = None"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1564 \ "Vim(python):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1565 call AssertException(["py vim.current.buffer[:] = []"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1566 \ "Vim(python):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1567 call AssertException(["py vim.current.buffer.append('abc')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1568 \ "Vim(python):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1569 call AssertException(["py vim.current.buffer.append([])"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1570 \ "Vim(python):vim.error: Vim:E21: Cannot make changes, 'modifiable' is off")
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1571 setlocal modifiable
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1572
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1573 augroup BUFS
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
1574 autocmd!
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1575 augroup END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1576 augroup! BUFS
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1577 %bw!
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1578
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1579 " Range object for a deleted buffer
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1580 new Xpbuffile
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1581 call setline(1, ['one', 'two', 'three'])
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1582 py b = vim.current.buffer
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1583 py r = vim.current.buffer.range(0, 2)
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1584 call assert_equal('<range Xpbuffile (0:2)>', pyeval('repr(r)'))
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1585 %bw!
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1586 call AssertException(['py r[:] = []'],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1587 \ 'Vim(python):vim.error: attempt to refer to deleted buffer')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1588 call assert_match('<buffer object (deleted)', pyeval('repr(b)'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1589 call assert_match('<range object (for deleted buffer)', pyeval('repr(r)'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1590 call AssertException(["let n = pyeval('len(r)')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1591 \ 'Vim(let):vim.error: attempt to refer to deleted buffer')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1592 call AssertException(["py r.append('abc')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1593 \ 'Vim(python):vim.error: attempt to refer to deleted buffer')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1594
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1595 " object for a deleted buffer
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1596 call AssertException(["py b[0] = 'one'"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1597 \ 'Vim(python):vim.error: attempt to refer to deleted buffer')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1598 call AssertException(["py b.append('one')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1599 \ 'Vim(python):vim.error: attempt to refer to deleted buffer')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1600 call AssertException(["let n = pyeval('len(b)')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1601 \ 'Vim(let):vim.error: attempt to refer to deleted buffer')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1602 call AssertException(["py pos = b.mark('a')"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1603 \ 'Vim(python):vim.error: attempt to refer to deleted buffer')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1604 call AssertException(["py vim.current.buffer = b"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1605 \ 'Vim(python):vim.error: attempt to refer to deleted buffer')
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1606 call AssertException(["py rn = b.range(0, 2)"],
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1607 \ 'Vim(python):vim.error: attempt to refer to deleted buffer')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1608 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1609
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1610 " Test vim.buffers object
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1611 func Test_python_buffers()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1612 %bw!
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1613 edit Xpbuffile
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1614 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1615 set hidden
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1616 edit a
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1617 buffer #
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1618 edit b
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1619 buffer #
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1620 edit c
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1621 buffer #
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1622 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1623 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1624 from __builtin__ import next
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1625 except ImportError:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1626 next = lambda o: o.next()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1627 # Check GCing iterator that was not fully exhausted
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1628 i = iter(vim.buffers)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1629 cb.append('i:' + str(next(i)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1630 # and also check creating more than one iterator at a time
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1631 i2 = iter(vim.buffers)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1632 cb.append('i2:' + str(next(i2)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1633 cb.append('i:' + str(next(i)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1634 # The following should trigger GC and not cause any problems
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1635 del i
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1636 del i2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1637 i3 = iter(vim.buffers)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1638 cb.append('i3:' + str(next(i3)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1639 del i3
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1640 EOF
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1641 call assert_equal(['i:<buffer Xpbuffile>',
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1642 \ 'i2:<buffer Xpbuffile>', 'i:<buffer a>', 'i3:<buffer Xpbuffile>'],
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1643 \ getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1644 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1645
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1646 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1647 prevnum = 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1648 for b in vim.buffers:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1649 # Check buffer order
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1650 if prevnum >= b.number:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1651 cb.append('!!! Buffer numbers not in strictly ascending order')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1652 # Check indexing: vim.buffers[number].number == number
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1653 cb.append(str(b.number) + ':' + repr(vim.buffers[b.number]) + \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1654 '=' + repr(b))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1655 prevnum = b.number
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1656 del prevnum
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1657
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1658 cb.append(str(len(vim.buffers)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1659 EOF
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1660 call assert_equal([bufnr('Xpbuffile') .. ':<buffer Xpbuffile>=<buffer Xpbuffile>',
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1661 \ bufnr('a') .. ':<buffer a>=<buffer a>',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1662 \ bufnr('b') .. ':<buffer b>=<buffer b>',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1663 \ bufnr('c') .. ':<buffer c>=<buffer c>', '4'], getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1664 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1665
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1666 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1667 bnums = list(map(lambda b: b.number, vim.buffers))[1:]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1668
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1669 # Test wiping out buffer with existing iterator
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1670 i4 = iter(vim.buffers)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1671 cb.append('i4:' + str(next(i4)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1672 vim.command('bwipeout! ' + str(bnums.pop(0)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1673 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1674 next(i4)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1675 except vim.error:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1676 pass
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1677 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1678 cb.append('!!!! No vim.error')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1679 i4 = iter(vim.buffers)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1680 vim.command('bwipeout! ' + str(bnums.pop(-1)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1681 vim.command('bwipeout! ' + str(bnums.pop(-1)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1682 cb.append('i4:' + str(next(i4)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1683 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1684 next(i4)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1685 except StopIteration:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1686 cb.append('StopIteration')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1687 del i4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1688 del bnums
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1689 EOF
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1690 call assert_equal(['i4:<buffer Xpbuffile>',
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1691 \ 'i4:<buffer Xpbuffile>', 'StopIteration'], getline(2, '$'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1692 %bw!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1693 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1694
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1695 " Test vim.{tabpage,window}list and vim.{tabpage,window} objects
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1696 func Test_python_tabpage_window()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1697 %bw
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1698 edit Xpbuffile
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1699 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1700 tabnew 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1701 tabnew 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1702 vnew a.1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1703 tabnew 2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1704 vnew a.2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1705 vnew b.2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1706 vnew c.2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1707
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1708 call assert_equal(4, pyeval('vim.current.window.tabpage.number'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1709
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1710 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1711 cb.append('Number of tabs: ' + str(len(vim.tabpages)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1712 cb.append('Current tab pages:')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1713 def W(w):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1714 if repr(w).find('(unknown)') != -1:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1715 return '<window object (unknown)>'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1716 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1717 return repr(w)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1718
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1719 start = len(cb)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1720
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1721 def Cursor(w):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1722 if w.buffer is cb:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1723 return repr((start - w.cursor[0], w.cursor[1]))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1724 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1725 return repr(w.cursor)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1726
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1727 for t in vim.tabpages:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1728 cb.append(' ' + repr(t) + '(' + str(t.number) + ')' + ': ' + \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1729 str(len(t.windows)) + ' windows, current is ' + W(t.window))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1730 cb.append(' Windows:')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1731 for w in t.windows:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1732 cb.append(' ' + W(w) + '(' + str(w.number) + ')' + \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1733 ': displays buffer ' + repr(w.buffer) + \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1734 '; cursor is at ' + Cursor(w))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1735 # Other values depend on the size of the terminal, so they are checked
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1736 # partly:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1737 for attr in ('height', 'row', 'width', 'col'):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1738 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1739 aval = getattr(w, attr)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1740 if type(aval) is not long:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1741 raise TypeError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1742 if aval < 0:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1743 raise ValueError
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1744 except Exception:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1745 cb.append('!!!!!! Error while getting attribute ' + attr + \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1746 ': ' + sys.exc_type.__name__)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1747 del aval
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1748 del attr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1749 w.cursor = (len(w.buffer), 0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1750 del W
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1751 del Cursor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1752 cb.append('Number of windows in current tab page: ' + \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1753 str(len(vim.windows)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1754 if list(vim.windows) != list(vim.current.tabpage.windows):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1755 cb.append('!!!!!! Windows differ')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1756 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1757
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
1758 let expected =<< trim END
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1759 Number of tabs: 4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1760 Current tab pages:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1761 <tabpage 0>(1): 1 windows, current is <window object (unknown)>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1762 Windows:
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1763 <window object (unknown)>(1): displays buffer <buffer Xpbuffile>; cursor is at (2, 0)
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1764 <tabpage 1>(2): 1 windows, current is <window object (unknown)>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1765 Windows:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1766 <window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1767 <tabpage 2>(3): 2 windows, current is <window object (unknown)>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1768 Windows:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1769 <window object (unknown)>(1): displays buffer <buffer a.1>; cursor is at (1, 0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1770 <window object (unknown)>(2): displays buffer <buffer 1>; cursor is at (1, 0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1771 <tabpage 3>(4): 4 windows, current is <window 0>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1772 Windows:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1773 <window 0>(1): displays buffer <buffer c.2>; cursor is at (1, 0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1774 <window 1>(2): displays buffer <buffer b.2>; cursor is at (1, 0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1775 <window 2>(3): displays buffer <buffer a.2>; cursor is at (1, 0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1776 <window 3>(4): displays buffer <buffer 2>; cursor is at (1, 0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1777 Number of windows in current tab page: 4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1778 END
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1779 call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1780 %bw!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1781 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1782
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1783 " Test vim.current
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1784 func Test_python_vim_current()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1785 %bw
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1786 edit Xpbuffile
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1787 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1788 tabnew 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1789 tabnew 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1790 vnew a.1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1791 tabnew 2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1792 vnew a.2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1793 vnew b.2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1794 vnew c.2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1795
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1796 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1797 def H(o):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1798 return repr(o)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1799 cb.append('Current tab page: ' + repr(vim.current.tabpage))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1800 cb.append('Current window: ' + repr(vim.current.window) + ': ' + \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1801 H(vim.current.window) + ' is ' + H(vim.current.tabpage.window))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1802 cb.append('Current buffer: ' + repr(vim.current.buffer) + ': ' + \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1803 H(vim.current.buffer) + ' is ' + H(vim.current.window.buffer)+ \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1804 ' is ' + H(vim.current.tabpage.window.buffer))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1805 del H
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1806 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1807 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1808 Current tab page: <tabpage 3>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1809 Current window: <window 0>: <window 0> is <window 0>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1810 Current buffer: <buffer c.2>: <buffer c.2> is <buffer c.2> is <buffer c.2>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1811 END
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1812 call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$'))
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1813 call deletebufline(bufnr('Xpbuffile'), 1, '$')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1814
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1815 " Assigning: fails
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1816 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1817 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1818 vim.current.window = vim.tabpages[0].window
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1819 except ValueError:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1820 cb.append('ValueError at assigning foreign tab window')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1821
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1822 for attr in ('window', 'tabpage', 'buffer'):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1823 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1824 setattr(vim.current, attr, None)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1825 except TypeError:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1826 cb.append('Type error at assigning None to vim.current.' + attr)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1827 del attr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1828 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1829
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1830 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1831 ValueError at assigning foreign tab window
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1832 Type error at assigning None to vim.current.window
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1833 Type error at assigning None to vim.current.tabpage
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1834 Type error at assigning None to vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1835 END
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1836 call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$'))
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1837 call deletebufline(bufnr('Xpbuffile'), 1, '$')
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1838
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1839 call setbufline(bufnr('Xpbuffile'), 1, 'python interface')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1840 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1841 # Assigning: success
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1842 vim.current.tabpage = vim.tabpages[-2]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1843 vim.current.buffer = cb
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1844 vim.current.window = vim.windows[0]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1845 vim.current.window.cursor = (len(vim.current.buffer), 0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1846 cb.append('Current tab page: ' + repr(vim.current.tabpage))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1847 cb.append('Current window: ' + repr(vim.current.window))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1848 cb.append('Current buffer: ' + repr(vim.current.buffer))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1849 cb.append('Current line: ' + repr(vim.current.line))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1850 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1851
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1852 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1853 Current tab page: <tabpage 2>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1854 Current window: <window 0>
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1855 Current buffer: <buffer Xpbuffile>
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1856 Current line: 'python interface'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1857 END
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1858 call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$'))
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1859 py vim.current.line = 'one line'
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1860 call assert_equal('one line', getline('.'))
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1861 call deletebufline(bufnr('Xpbuffile'), 1, '$')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1862
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1863 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1864 ws = list(vim.windows)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1865 ts = list(vim.tabpages)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1866 for b in vim.buffers:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1867 if b is not cb:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1868 vim.command('bwipeout! ' + str(b.number))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1869 del b
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1870 cb.append('w.valid: ' + repr([w.valid for w in ws]))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1871 cb.append('t.valid: ' + repr([t.valid for t in ts]))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1872 del w
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1873 del t
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1874 del ts
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1875 del ws
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1876 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1877 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1878 w.valid: [True, False]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1879 t.valid: [True, False, True, False]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1880 END
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1881 call assert_equal(expected, getbufline(bufnr('Xpbuffile'), 2, '$'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1882 %bw!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1883 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1884
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1885 " Test types
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1886 func Test_python_types()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1887 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1888 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1889 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1890 for expr, attr in (
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1891 ('vim.vars', 'Dictionary'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1892 ('vim.options', 'Options'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1893 ('vim.bindeval("{}")', 'Dictionary'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1894 ('vim.bindeval("[]")', 'List'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1895 ('vim.bindeval("function(\'tr\')")', 'Function'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1896 ('vim.current.buffer', 'Buffer'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1897 ('vim.current.range', 'Range'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1898 ('vim.current.window', 'Window'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1899 ('vim.current.tabpage', 'TabPage'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1900 ):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1901 cb.append(expr + ':' + attr + ':' + \
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1902 repr(type(eval(expr)) is getattr(vim, attr)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1903 del expr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1904 del attr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1905 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1906 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1907 vim.vars:Dictionary:True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1908 vim.options:Options:True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1909 vim.bindeval("{}"):Dictionary:True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1910 vim.bindeval("[]"):List:True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1911 vim.bindeval("function('tr')"):Function:True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1912 vim.current.buffer:Buffer:True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1913 vim.current.range:Range:True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1914 vim.current.window:Window:True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1915 vim.current.tabpage:TabPage:True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1916 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1917 call assert_equal(expected, getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1918 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1919
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1920 " Test __dir__() method
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1921 func Test_python_dir_method()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1922 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1923 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1924 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1925 for name, o in (
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1926 ('current', vim.current),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1927 ('buffer', vim.current.buffer),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1928 ('window', vim.current.window),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1929 ('tabpage', vim.current.tabpage),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1930 ('range', vim.current.range),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1931 ('dictionary', vim.bindeval('{}')),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1932 ('list', vim.bindeval('[]')),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1933 ('function', vim.bindeval('function("tr")')),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1934 ('output', sys.stdout),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1935 ):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1936 cb.append(name + ':' + ','.join(dir(o)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1937 del name
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1938 del o
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1939 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1940 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1941 current:__dir__,__members__,buffer,line,range,tabpage,window
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1942 buffer:__dir__,__members__,append,mark,name,number,options,range,valid,vars
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1943 window:__dir__,__members__,buffer,col,cursor,height,number,options,row,tabpage,valid,vars,width
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1944 tabpage:__dir__,__members__,number,valid,vars,window,windows
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1945 range:__dir__,__members__,append,end,start
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1946 dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1947 list:__dir__,__members__,extend,locked
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1948 function:__dir__,__members__,args,auto_rebind,self,softspace
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1949 output:__dir__,__members__,close,closed,flush,isatty,readable,seekable,softspace,writable,write,writelines
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1950 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1951 call assert_equal(expected, getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1952 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1953
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1954 " Test vim.*.__new__
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1955 func Test_python_new()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1956 call assert_equal({}, pyeval('vim.Dictionary({})'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1957 call assert_equal({'a': 1}, pyeval('vim.Dictionary(a=1)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1958 call assert_equal({'a': 1}, pyeval('vim.Dictionary(((''a'', 1),))'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1959 call assert_equal([], pyeval('vim.List()'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1960 call assert_equal(['a', 'b', 'c', '7'], pyeval('vim.List(iter(''abc7''))'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1961 call assert_equal(function('tr'), pyeval('vim.Function(''tr'')'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1962 call assert_equal(function('tr', [123, 3, 4]),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1963 \ pyeval('vim.Function(''tr'', args=[123, 3, 4])'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1964 call assert_equal(function('tr'), pyeval('vim.Function(''tr'', args=[])'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1965 call assert_equal(function('tr', {}),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1966 \ pyeval('vim.Function(''tr'', self={})'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1967 call assert_equal(function('tr', [123, 3, 4], {}),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1968 \ pyeval('vim.Function(''tr'', args=[123, 3, 4], self={})'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1969 call assert_equal(function('tr'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1970 \ pyeval('vim.Function(''tr'', auto_rebind=False)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1971 call assert_equal(function('tr', [123, 3, 4]),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1972 \ pyeval('vim.Function(''tr'', args=[123, 3, 4], auto_rebind=False)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1973 call assert_equal(function('tr'),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1974 \ pyeval('vim.Function(''tr'', args=[], auto_rebind=False)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1975 call assert_equal(function('tr', {}),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1976 \ pyeval('vim.Function(''tr'', self={}, auto_rebind=False)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1977 call assert_equal(function('tr', [123, 3, 4], {}),
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1978 \ pyeval('vim.Function(''tr'', args=[123, 3, 4], self={}, auto_rebind=False)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1979 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1980
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1981 " Test vim.Function
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1982 func Test_python_vim_func()
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1983 func Args(...)
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1984 return a:000
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1985 endfunc
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1986
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1987 func SelfArgs(...) dict
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1988 return [a:000, self]
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1989 endfunc
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1990
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1991 " The following four lines should not crash
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1992 let Pt = function('tr', [[]], {'l': []})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1993 py Pt = vim.bindeval('Pt')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1994 unlet Pt
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1995 py del Pt
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1996
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1997 call assert_equal(3, pyeval('vim.strwidth("a\tb")'))
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
1998
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
1999 %bw!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2000 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2001 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2002 def ecall(out_prefix, func, *args, **kwargs):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2003 line = out_prefix + ': '
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2004 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2005 ret = func(*args, **kwargs)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2006 except Exception:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2007 line += '!exception: ' + emsg(sys.exc_info())
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2008 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2009 line += '!result: ' + vim.Function('string')(ret)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2010 cb.append(line)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2011 a = vim.Function('Args')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2012 pa1 = vim.Function('Args', args=['abcArgsPA1'])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2013 pa2 = vim.Function('Args', args=[])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2014 pa3 = vim.Function('Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2015 pa4 = vim.Function('Args', self={'abcSelfPA4': 'abcSelfPA4Val'})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2016 cb.append('a: ' + repr(a))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2017 cb.append('pa1: ' + repr(pa1))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2018 cb.append('pa2: ' + repr(pa2))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2019 cb.append('pa3: ' + repr(pa3))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2020 cb.append('pa4: ' + repr(pa4))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2021 sa = vim.Function('SelfArgs')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2022 psa1 = vim.Function('SelfArgs', args=['abcArgsPSA1'])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2023 psa2 = vim.Function('SelfArgs', args=[])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2024 psa3 = vim.Function('SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2025 psa4 = vim.Function('SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2026 psa5 = vim.Function('SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}, auto_rebind=0)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2027 psa6 = vim.Function('SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}, auto_rebind=())
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2028 psa7 = vim.Function('SelfArgs', args=['abcArgsPSA7'], auto_rebind=[])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2029 psa8 = vim.Function('SelfArgs', auto_rebind=False)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2030 psa9 = vim.Function('SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2031 psaA = vim.Function('SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto_rebind=1)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2032 psaB = vim.Function('SelfArgs', args=['abcArgsPSAB'], auto_rebind={'abcARPSAB': 'abcARPSABVal'})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2033 psaC = vim.Function('SelfArgs', auto_rebind=['abcARPSAC'])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2034 cb.append('sa: ' + repr(sa))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2035 cb.append('psa1: ' + repr(psa1))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2036 cb.append('psa2: ' + repr(psa2))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2037 cb.append('psa3: ' + repr(psa3))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2038 cb.append('psa4: ' + repr(psa4))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2039 cb.append('psa5: ' + repr(psa5))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2040 cb.append('psa6: ' + repr(psa6))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2041 cb.append('psa7: ' + repr(psa7))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2042 cb.append('psa8: ' + repr(psa8))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2043 cb.append('psa9: ' + repr(psa9))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2044 cb.append('psaA: ' + repr(psaA))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2045 cb.append('psaB: ' + repr(psaB))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2046 cb.append('psaC: ' + repr(psaC))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2047
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2048 psar = vim.Function('SelfArgs', args=[{'abcArgsPSAr': 'abcArgsPSArVal'}], self={'abcSelfPSAr': 'abcSelfPSArVal'})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2049 psar.args[0]['abcArgsPSAr2'] = [psar.self, psar.args[0]]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2050 psar.self['rec'] = psar
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2051 psar.self['self'] = psar.self
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2052 psar.self['args'] = psar.args
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2053
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2054 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2055 cb.append('psar: ' + repr(psar))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2056 except Exception:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2057 cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info()))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2058 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2059
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2060 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2061 a: <vim.Function 'Args'>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2062 pa1: <vim.Function 'Args', args=['abcArgsPA1']>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2063 pa2: <vim.Function 'Args'>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2064 pa3: <vim.Function 'Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'}>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2065 pa4: <vim.Function 'Args', self={'abcSelfPA4': 'abcSelfPA4Val'}>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2066 sa: <vim.Function 'SelfArgs'>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2067 psa1: <vim.Function 'SelfArgs', args=['abcArgsPSA1']>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2068 psa2: <vim.Function 'SelfArgs'>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2069 psa3: <vim.Function 'SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'}>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2070 psa4: <vim.Function 'SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'}>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2071 psa5: <vim.Function 'SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2072 psa6: <vim.Function 'SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2073 psa7: <vim.Function 'SelfArgs', args=['abcArgsPSA7']>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2074 psa8: <vim.Function 'SelfArgs'>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2075 psa9: <vim.Function 'SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2076 psaA: <vim.Function 'SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto_rebind=True>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2077 psaB: <vim.Function 'SelfArgs', args=['abcArgsPSAB']>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2078 psaC: <vim.Function 'SelfArgs'>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2079 psar: <vim.Function 'SelfArgs', args=[{'abcArgsPSAr2': [{'rec': function('SelfArgs', [{...}], {...}), 'self': {...}, 'abcSelfPSAr': 'abcSelfPSArVal', 'args': [{...}]}, {...}], 'abcArgsPSAr': 'abcArgsPSArVal'}], self={'rec': function('SelfArgs', [{'abcArgsPSAr2': [{...}, {...}], 'abcArgsPSAr': 'abcArgsPSArVal'}], {...}), 'self': {...}, 'abcSelfPSAr': 'abcSelfPSArVal', 'args': [{'abcArgsPSAr2': [{...}, {...}], 'abcArgsPSAr': 'abcArgsPSArVal'}]}>
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2080 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2081 call assert_equal(expected, getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2082 %d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2083
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2084 call assert_equal(function('Args'), pyeval('a'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2085 call assert_equal(function('Args', ['abcArgsPA1']), pyeval('pa1'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2086 call assert_equal(function('Args'), pyeval('pa2'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2087 call assert_equal(function('Args', ['abcArgsPA3'], {'abcSelfPA3': 'abcSelfPA3Val'}), pyeval('pa3'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2088 call assert_equal(function('Args', {'abcSelfPA4': 'abcSelfPA4Val'}), pyeval('pa4'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2089 call assert_equal(function('SelfArgs'), pyeval('sa'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2090 call assert_equal(function('SelfArgs', ['abcArgsPSA1']), pyeval('psa1'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2091 call assert_equal(function('SelfArgs'), pyeval('psa2'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2092 call assert_equal(function('SelfArgs', ['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}), pyeval('psa3'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2093 call assert_equal(function('SelfArgs', {'abcSelfPSA4': 'abcSelfPSA4Val'}), pyeval('psa4'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2094 call assert_equal(function('SelfArgs', {'abcSelfPSA5': 'abcSelfPSA5Val'}), pyeval('psa5'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2095 call assert_equal(function('SelfArgs', ['abcArgsPSA6'], {'abcSelfPSA6': 'abcSelfPSA6Val'}), pyeval('psa6'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2096 call assert_equal(function('SelfArgs', ['abcArgsPSA7']), pyeval('psa7'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2097 call assert_equal(function('SelfArgs'), pyeval('psa8'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2098 call assert_equal(function('SelfArgs', {'abcSelfPSA9': 'abcSelfPSA9Val'}), pyeval('psa9'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2099 call assert_equal(function('SelfArgs', ['abcArgsPSAA'], {'abcSelfPSAA': 'abcSelfPSAAVal'}), pyeval('psaA'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2100 call assert_equal(function('SelfArgs', ['abcArgsPSAB']), pyeval('psaB'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2101 call assert_equal(function('SelfArgs'), pyeval('psaC'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2102
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2103 let res = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2104 for v in ['sa', 'psa1', 'psa2', 'psa3', 'psa4', 'psa5', 'psa6', 'psa7',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2105 \ 'psa8', 'psa9', 'psaA', 'psaB', 'psaC']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2106 let d = {'f': pyeval(v)}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2107 call add(res, 'd.' .. v .. '(): ' .. string(d.f()))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2108 endfor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2109
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2110 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2111 d.sa(): [[], {'f': function('SelfArgs')}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2112 d.psa1(): [['abcArgsPSA1'], {'f': function('SelfArgs', ['abcArgsPSA1'])}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2113 d.psa2(): [[], {'f': function('SelfArgs')}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2114 d.psa3(): [['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2115 d.psa4(): [[], {'abcSelfPSA4': 'abcSelfPSA4Val'}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2116 d.psa5(): [[], {'abcSelfPSA5': 'abcSelfPSA5Val'}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2117 d.psa6(): [['abcArgsPSA6'], {'abcSelfPSA6': 'abcSelfPSA6Val'}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2118 d.psa7(): [['abcArgsPSA7'], {'f': function('SelfArgs', ['abcArgsPSA7'])}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2119 d.psa8(): [[], {'f': function('SelfArgs')}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2120 d.psa9(): [[], {'f': function('SelfArgs', {'abcSelfPSA9': 'abcSelfPSA9Val'})}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2121 d.psaA(): [['abcArgsPSAA'], {'f': function('SelfArgs', ['abcArgsPSAA'], {'abcSelfPSAA': 'abcSelfPSAAVal'})}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2122 d.psaB(): [['abcArgsPSAB'], {'f': function('SelfArgs', ['abcArgsPSAB'])}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2123 d.psaC(): [[], {'f': function('SelfArgs')}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2124 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2125 call assert_equal(expected, res)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2126
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2127 py ecall('a()', a, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2128 py ecall('pa1()', pa1, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2129 py ecall('pa2()', pa2, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2130 py ecall('pa3()', pa3, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2131 py ecall('pa4()', pa4, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2132 py ecall('sa()', sa, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2133 py ecall('psa1()', psa1, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2134 py ecall('psa2()', psa2, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2135 py ecall('psa3()', psa3, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2136 py ecall('psa4()', psa4, )
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2137
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2138 py ecall('a(42, 43)', a, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2139 py ecall('pa1(42, 43)', pa1, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2140 py ecall('pa2(42, 43)', pa2, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2141 py ecall('pa3(42, 43)', pa3, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2142 py ecall('pa4(42, 43)', pa4, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2143 py ecall('sa(42, 43)', sa, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2144 py ecall('psa1(42, 43)', psa1, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2145 py ecall('psa2(42, 43)', psa2, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2146 py ecall('psa3(42, 43)', psa3, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2147 py ecall('psa4(42, 43)', psa4, 42, 43)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2148
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2149 py ecall('a(42, self={"20": 1})', a, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2150 py ecall('pa1(42, self={"20": 1})', pa1, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2151 py ecall('pa2(42, self={"20": 1})', pa2, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2152 py ecall('pa3(42, self={"20": 1})', pa3, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2153 py ecall('pa4(42, self={"20": 1})', pa4, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2154 py ecall('sa(42, self={"20": 1})', sa, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2155 py ecall('psa1(42, self={"20": 1})', psa1, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2156 py ecall('psa2(42, self={"20": 1})', psa2, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2157 py ecall('psa3(42, self={"20": 1})', psa3, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2158 py ecall('psa4(42, self={"20": 1})', psa4, 42, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2159
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2160 py ecall('a(self={"20": 1})', a, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2161 py ecall('pa1(self={"20": 1})', pa1, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2162 py ecall('pa2(self={"20": 1})', pa2, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2163 py ecall('pa3(self={"20": 1})', pa3, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2164 py ecall('pa4(self={"20": 1})', pa4, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2165 py ecall('sa(self={"20": 1})', sa, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2166 py ecall('psa1(self={"20": 1})', psa1, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2167 py ecall('psa2(self={"20": 1})', psa2, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2168 py ecall('psa3(self={"20": 1})', psa3, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2169 py ecall('psa4(self={"20": 1})', psa4, self={'20': 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2170
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2171 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2172 def s(v):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2173 if v is None:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2174 return repr(v)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2175 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2176 return vim.Function('string')(v)
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2177
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2178 cb.append('a.args: ' + s(a.args))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2179 cb.append('pa1.args: ' + s(pa1.args))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2180 cb.append('pa2.args: ' + s(pa2.args))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2181 cb.append('pa3.args: ' + s(pa3.args))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2182 cb.append('pa4.args: ' + s(pa4.args))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2183 cb.append('sa.args: ' + s(sa.args))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2184 cb.append('psa1.args: ' + s(psa1.args))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2185 cb.append('psa2.args: ' + s(psa2.args))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2186 cb.append('psa3.args: ' + s(psa3.args))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2187 cb.append('psa4.args: ' + s(psa4.args))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2188
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2189 cb.append('a.self: ' + s(a.self))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2190 cb.append('pa1.self: ' + s(pa1.self))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2191 cb.append('pa2.self: ' + s(pa2.self))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2192 cb.append('pa3.self: ' + s(pa3.self))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2193 cb.append('pa4.self: ' + s(pa4.self))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2194 cb.append('sa.self: ' + s(sa.self))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2195 cb.append('psa1.self: ' + s(psa1.self))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2196 cb.append('psa2.self: ' + s(psa2.self))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2197 cb.append('psa3.self: ' + s(psa3.self))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2198 cb.append('psa4.self: ' + s(psa4.self))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2199
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2200 cb.append('a.name: ' + s(a.name))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2201 cb.append('pa1.name: ' + s(pa1.name))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2202 cb.append('pa2.name: ' + s(pa2.name))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2203 cb.append('pa3.name: ' + s(pa3.name))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2204 cb.append('pa4.name: ' + s(pa4.name))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2205 cb.append('sa.name: ' + s(sa.name))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2206 cb.append('psa1.name: ' + s(psa1.name))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2207 cb.append('psa2.name: ' + s(psa2.name))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2208 cb.append('psa3.name: ' + s(psa3.name))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2209 cb.append('psa4.name: ' + s(psa4.name))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2210
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2211 cb.append('a.auto_rebind: ' + s(a.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2212 cb.append('pa1.auto_rebind: ' + s(pa1.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2213 cb.append('pa2.auto_rebind: ' + s(pa2.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2214 cb.append('pa3.auto_rebind: ' + s(pa3.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2215 cb.append('pa4.auto_rebind: ' + s(pa4.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2216 cb.append('sa.auto_rebind: ' + s(sa.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2217 cb.append('psa1.auto_rebind: ' + s(psa1.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2218 cb.append('psa2.auto_rebind: ' + s(psa2.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2219 cb.append('psa3.auto_rebind: ' + s(psa3.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2220 cb.append('psa4.auto_rebind: ' + s(psa4.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2221 cb.append('psa5.auto_rebind: ' + s(psa5.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2222 cb.append('psa6.auto_rebind: ' + s(psa6.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2223 cb.append('psa7.auto_rebind: ' + s(psa7.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2224 cb.append('psa8.auto_rebind: ' + s(psa8.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2225 cb.append('psa9.auto_rebind: ' + s(psa9.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2226 cb.append('psaA.auto_rebind: ' + s(psaA.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2227 cb.append('psaB.auto_rebind: ' + s(psaB.auto_rebind))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2228 cb.append('psaC.auto_rebind: ' + s(psaC.auto_rebind))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2229
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2230 del s
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2231
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2232 del a
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2233 del pa1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2234 del pa2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2235 del pa3
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2236 del pa4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2237 del sa
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2238 del psa1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2239 del psa2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2240 del psa3
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2241 del psa4
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2242 del psa5
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2243 del psa6
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2244 del psa7
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2245 del psa8
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2246 del psa9
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2247 del psaA
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2248 del psaB
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2249 del psaC
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2250 del psar
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2251
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2252 del ecall
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2253 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2254
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2255 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2256 a(): !result: []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2257 pa1(): !result: ['abcArgsPA1']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2258 pa2(): !result: []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2259 pa3(): !result: ['abcArgsPA3']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2260 pa4(): !result: []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2261 sa(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2262 psa1(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2263 psa2(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2264 psa3(): !result: [['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2265 psa4(): !result: [[], {'abcSelfPSA4': 'abcSelfPSA4Val'}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2266 a(42, 43): !result: [42, 43]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2267 pa1(42, 43): !result: ['abcArgsPA1', 42, 43]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2268 pa2(42, 43): !result: [42, 43]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2269 pa3(42, 43): !result: ['abcArgsPA3', 42, 43]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2270 pa4(42, 43): !result: [42, 43]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2271 sa(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2272 psa1(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2273 psa2(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2274 psa3(42, 43): !result: [['abcArgsPSA3', 42, 43], {'abcSelfPSA3': 'abcSelfPSA3Val'}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2275 psa4(42, 43): !result: [[42, 43], {'abcSelfPSA4': 'abcSelfPSA4Val'}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2276 a(42, self={"20": 1}): !result: [42]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2277 pa1(42, self={"20": 1}): !result: ['abcArgsPA1', 42]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2278 pa2(42, self={"20": 1}): !result: [42]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2279 pa3(42, self={"20": 1}): !result: ['abcArgsPA3', 42]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2280 pa4(42, self={"20": 1}): !result: [42]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2281 sa(42, self={"20": 1}): !result: [[42], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2282 psa1(42, self={"20": 1}): !result: [['abcArgsPSA1', 42], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2283 psa2(42, self={"20": 1}): !result: [[42], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2284 psa3(42, self={"20": 1}): !result: [['abcArgsPSA3', 42], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2285 psa4(42, self={"20": 1}): !result: [[42], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2286 a(self={"20": 1}): !result: []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2287 pa1(self={"20": 1}): !result: ['abcArgsPA1']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2288 pa2(self={"20": 1}): !result: []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2289 pa3(self={"20": 1}): !result: ['abcArgsPA3']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2290 pa4(self={"20": 1}): !result: []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2291 sa(self={"20": 1}): !result: [[], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2292 psa1(self={"20": 1}): !result: [['abcArgsPSA1'], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2293 psa2(self={"20": 1}): !result: [[], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2294 psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2295 psa4(self={"20": 1}): !result: [[], {'20': 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2296 a.args: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2297 pa1.args: ['abcArgsPA1']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2298 pa2.args: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2299 pa3.args: ['abcArgsPA3']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2300 pa4.args: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2301 sa.args: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2302 psa1.args: ['abcArgsPSA1']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2303 psa2.args: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2304 psa3.args: ['abcArgsPSA3']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2305 psa4.args: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2306 a.self: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2307 pa1.self: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2308 pa2.self: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2309 pa3.self: {'abcSelfPA3': 'abcSelfPA3Val'}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2310 pa4.self: {'abcSelfPA4': 'abcSelfPA4Val'}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2311 sa.self: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2312 psa1.self: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2313 psa2.self: None
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2314 psa3.self: {'abcSelfPSA3': 'abcSelfPSA3Val'}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2315 psa4.self: {'abcSelfPSA4': 'abcSelfPSA4Val'}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2316 a.name: 'Args'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2317 pa1.name: 'Args'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2318 pa2.name: 'Args'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2319 pa3.name: 'Args'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2320 pa4.name: 'Args'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2321 sa.name: 'SelfArgs'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2322 psa1.name: 'SelfArgs'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2323 psa2.name: 'SelfArgs'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2324 psa3.name: 'SelfArgs'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2325 psa4.name: 'SelfArgs'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2326 a.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2327 pa1.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2328 pa2.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2329 pa3.auto_rebind: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2330 pa4.auto_rebind: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2331 sa.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2332 psa1.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2333 psa2.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2334 psa3.auto_rebind: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2335 psa4.auto_rebind: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2336 psa5.auto_rebind: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2337 psa6.auto_rebind: 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2338 psa7.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2339 psa8.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2340 psa9.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2341 psaA.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2342 psaB.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2343 psaC.auto_rebind: 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2344 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2345 call assert_equal(expected, getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2346 %bw!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2347 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2348
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2349 " Test stdout/stderr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2350 func Test_python_stdin_stderr()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2351 let caught_writeerr = 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2352 let caught_writelineerr = 0
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2353 redir => messages
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2354 py sys.stdout.write('abc8') ; sys.stdout.write('def')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2355 try
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2356 py sys.stderr.write('abc9') ; sys.stderr.write('def')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2357 catch /abc9def/
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2358 let caught_writeerr = 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2359 endtry
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2360 py sys.stdout.writelines(iter('abcA'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2361 try
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2362 py sys.stderr.writelines(iter('abcB'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2363 catch /abcB/
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2364 let caught_writelineerr = 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2365 endtry
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2366 redir END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2367 call assert_equal("\nabc8def\nabcA", messages)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2368 call assert_equal(1, caught_writeerr)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2369 call assert_equal(1, caught_writelineerr)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2370 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2371
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2372 " Test subclassing
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2373 func Test_python_subclass()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2374 new
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
2375 func Put(...)
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
2376 return a:000
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
2377 endfunc
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2378
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2379 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2380 class DupDict(vim.Dictionary):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2381 def __setitem__(self, key, value):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2382 super(DupDict, self).__setitem__(key, value)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2383 super(DupDict, self).__setitem__('dup_' + key, value)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2384 dd = DupDict()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2385 dd['a'] = 'b'
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2386
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2387 class DupList(vim.List):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2388 def __getitem__(self, idx):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2389 return [super(DupList, self).__getitem__(idx)] * 2
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2390
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2391 dl = DupList()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2392 dl2 = DupList(iter('abcC'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2393 dl.extend(dl2[0])
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2394
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2395 class DupFun(vim.Function):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2396 def __call__(self, arg):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2397 return super(DupFun, self).__call__(arg, arg)
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2398
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2399 df = DupFun('Put')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2400 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2401
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2402 call assert_equal(['a', 'dup_a'], sort(keys(pyeval('dd'))))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2403 call assert_equal(['a', 'a'], pyeval('dl'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2404 call assert_equal(['a', 'b', 'c', 'C'], pyeval('dl2'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2405 call assert_equal([2, 2], pyeval('df(2)'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2406 call assert_equal(1, pyeval('dl') is# pyeval('dl'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2407 call assert_equal(1, pyeval('dd') is# pyeval('dd'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2408 call assert_equal(function('Put'), pyeval('df'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2409 delfunction Put
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2410 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2411 del DupDict
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2412 del DupList
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2413 del DupFun
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2414 del dd
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2415 del dl
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2416 del dl2
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2417 del df
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2418 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2419 close!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2420 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2421
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2422 " Test chdir
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2423 func Test_python_chdir()
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2424 new Xpycfile
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2425 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2426 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2427 import os
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2428 fnamemodify = vim.Function('fnamemodify')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2429 cb.append(fnamemodify('.', ':p:h:t'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2430 cb.append(vim.eval('@%'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2431 os.chdir('..')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2432 path = fnamemodify('.', ':p:h:t')
22011
2b6d696b063d patch 8.2.1555: not all tests are executed on Github Actions
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
2433 if path != 'src' and path != 'src2':
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2434 # Running tests from a shadow directory, so move up another level
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2435 # This will result in @% looking like shadow/testdir/Xpycfile, hence the
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2436 # extra fnamemodify
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2437 os.chdir('..')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2438 cb.append(fnamemodify('.', ':p:h:t'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2439 cb.append(fnamemodify(vim.eval('@%'), ':s?^%s.??' % path).replace(os.path.sep, '/'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2440 os.chdir(path)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2441 del path
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2442 else:
22011
2b6d696b063d patch 8.2.1555: not all tests are executed on Github Actions
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
2443 # Also accept running from src2/testdir/ for MS-Windows CI.
2b6d696b063d patch 8.2.1555: not all tests are executed on Github Actions
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
2444 cb.append(fnamemodify('.', ':p:h:t').replace('src2', 'src'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2445 cb.append(vim.eval('@%').replace(os.path.sep, '/'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2446 os.chdir('testdir')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2447 cb.append(fnamemodify('.', ':p:h:t'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2448 cb.append(vim.eval('@%'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2449 del fnamemodify
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2450 EOF
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2451 call assert_equal(['testdir', 'Xpycfile', 'src', 'testdir/Xpycfile', 'testdir',
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2452 \ 'Xpycfile'], getline(2, '$'))
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2453 close!
21200
37edecbfb834 patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents: 21198
diff changeset
2454 call AssertException(["py vim.chdir(None)"], "Vim(python):TypeError:")
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2455 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2456
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2457 " Test errors
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2458 func Test_python_errors()
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
2459 func F() dict
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
2460 endfunc
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2461
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
2462 func D()
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
2463 endfunc
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2464
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2465 new
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2466 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2467
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2468 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2469 d = vim.Dictionary()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2470 ned = vim.Dictionary(foo='bar', baz='abcD')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2471 dl = vim.Dictionary(a=1)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2472 dl.locked = True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2473 l = vim.List()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2474 ll = vim.List('abcE')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2475 ll.locked = True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2476 nel = vim.List('abcO')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2477 f = vim.Function('string')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2478 fd = vim.Function('F')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2479 fdel = vim.Function('D')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2480 vim.command('delfunction D')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2481
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2482 def subexpr_test(expr, name, subexprs):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2483 cb.append('>>> Testing %s using %s' % (name, expr))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2484 for subexpr in subexprs:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2485 ee(expr % subexpr)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2486 cb.append('<<< Finished')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2487
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2488 def stringtochars_test(expr):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2489 return subexpr_test(expr, 'StringToChars', (
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2490 '1', # Fail type checks
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2491 'u"\\0"', # Fail PyString_AsStringAndSize(bytes, , NULL) check
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2492 '"\\0"', # Fail PyString_AsStringAndSize(object, , NULL) check
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2493 ))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2494
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2495 class Mapping(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2496 def __init__(self, d):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2497 self.d = d
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2498
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2499 def __getitem__(self, key):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2500 return self.d[key]
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2501
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2502 def keys(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2503 return self.d.keys()
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2504
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2505 def items(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2506 return self.d.items()
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2507
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2508 def convertfrompyobject_test(expr, recurse=True):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2509 # pydict_to_tv
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2510 stringtochars_test(expr % '{%s : 1}')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2511 if recurse:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2512 convertfrompyobject_test(expr % '{"abcF" : %s}', False)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2513 # pymap_to_tv
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2514 stringtochars_test(expr % 'Mapping({%s : 1})')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2515 if recurse:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2516 convertfrompyobject_test(expr % 'Mapping({"abcG" : %s})', False)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2517 # pyseq_to_tv
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2518 iter_test(expr)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2519 return subexpr_test(expr, 'ConvertFromPyObject', (
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2520 'None', # Not conversible
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2521 '{"": 1}', # Empty key not allowed
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2522 '{u"": 1}', # Same, but with unicode object
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2523 'FailingMapping()', #
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2524 'FailingMappingKey()', #
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2525 'FailingNumber()', #
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2526 ))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2527
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2528 def convertfrompymapping_test(expr):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2529 convertfrompyobject_test(expr)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2530 return subexpr_test(expr, 'ConvertFromPyMapping', (
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2531 '[]',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2532 ))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2533
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2534 def iter_test(expr):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2535 return subexpr_test(expr, '*Iter*', (
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2536 'FailingIter()',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2537 'FailingIterNext()',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2538 ))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2539
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2540 def number_test(expr, natural=False, unsigned=False):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2541 if natural:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2542 unsigned = True
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2543 return subexpr_test(expr, 'NumberToLong', (
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2544 '[]',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2545 'None',
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2546 ) + (unsigned and ('-1',) or ())
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2547 + (natural and ('0',) or ()))
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2548
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2549 class FailingTrue(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2550 def __nonzero__(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2551 raise NotImplementedError('bool')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2552
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2553 class FailingIter(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2554 def __iter__(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2555 raise NotImplementedError('iter')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2556
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2557 class FailingIterNext(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2558 def __iter__(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2559 return self
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2560
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2561 def next(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2562 raise NotImplementedError('next')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2563
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2564 class FailingIterNextN(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2565 def __init__(self, n):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2566 self.n = n
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2567
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2568 def __iter__(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2569 return self
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2570
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2571 def next(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2572 if self.n:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2573 self.n -= 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2574 return 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2575 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2576 raise NotImplementedError('next N')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2577
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2578 class FailingMappingKey(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2579 def __getitem__(self, item):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2580 raise NotImplementedError('getitem:mappingkey')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2581
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2582 def keys(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2583 return list("abcH")
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2584
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2585 class FailingMapping(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2586 def __getitem__(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2587 raise NotImplementedError('getitem:mapping')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2588
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2589 def keys(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2590 raise NotImplementedError('keys')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2591
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2592 class FailingList(list):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2593 def __getitem__(self, idx):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2594 if i == 2:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2595 raise NotImplementedError('getitem:list')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2596 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2597 return super(FailingList, self).__getitem__(idx)
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2598
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2599 class NoArgsCall(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2600 def __call__(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2601 pass
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2602
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2603 class FailingCall(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2604 def __call__(self, path):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2605 raise NotImplementedError('call')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2606
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2607 class FailingNumber(object):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2608 def __int__(self):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2609 raise NotImplementedError('int')
21144
adae19565eea patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents: 21138
diff changeset
2610
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2611 cb.append("> Output")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2612 cb.append(">> OutputSetattr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2613 ee('del sys.stdout.softspace')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2614 number_test('sys.stdout.softspace = %s', unsigned=True)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2615 number_test('sys.stderr.softspace = %s', unsigned=True)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2616 ee('assert sys.stdout.isatty()==False')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2617 ee('assert sys.stdout.seekable()==False')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2618 ee('sys.stdout.close()')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2619 ee('sys.stdout.flush()')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2620 ee('assert sys.stderr.isatty()==False')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2621 ee('assert sys.stderr.seekable()==False')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2622 ee('sys.stderr.close()')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2623 ee('sys.stderr.flush()')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2624 ee('sys.stdout.attr = None')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2625 cb.append(">> OutputWrite")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2626 ee('assert sys.stdout.writable()==True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2627 ee('assert sys.stdout.readable()==False')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2628 ee('assert sys.stderr.writable()==True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2629 ee('assert sys.stderr.readable()==False')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2630 ee('assert sys.stdout.closed()==False')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2631 ee('assert sys.stderr.closed()==False')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2632 ee('assert sys.stdout.errors=="strict"')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2633 ee('assert sys.stderr.errors=="strict"')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2634 ee('assert sys.stdout.encoding==sys.stderr.encoding')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2635 ee('sys.stdout.write(None)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2636 cb.append(">> OutputWriteLines")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2637 ee('sys.stdout.writelines(None)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2638 ee('sys.stdout.writelines([1])')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2639 iter_test('sys.stdout.writelines(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2640 cb.append("> VimCommand")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2641 stringtochars_test('vim.command(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2642 ee('vim.command("", 2)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2643 #! Not checked: vim->python exceptions translating: checked later
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2644 cb.append("> VimToPython")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2645 #! Not checked: everything: needs errors in internal python functions
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2646 cb.append("> VimEval")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2647 stringtochars_test('vim.eval(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2648 ee('vim.eval("", FailingTrue())')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2649 #! Not checked: everything: needs errors in internal python functions
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2650 cb.append("> VimEvalPy")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2651 stringtochars_test('vim.bindeval(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2652 ee('vim.eval("", 2)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2653 #! Not checked: vim->python exceptions translating: checked later
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2654 cb.append("> VimStrwidth")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2655 stringtochars_test('vim.strwidth(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2656 cb.append("> VimForeachRTP")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2657 ee('vim.foreach_rtp(None)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2658 ee('vim.foreach_rtp(NoArgsCall())')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2659 ee('vim.foreach_rtp(FailingCall())')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2660 ee('vim.foreach_rtp(int, 2)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2661 cb.append('> import')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2662 old_rtp = vim.options['rtp']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2663 vim.options['rtp'] = os.getcwd().replace('\\', '\\\\').replace(',', '\\,')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2664 ee('import xxx_no_such_module_xxx')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2665 ee('import failing_import')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2666 ee('import failing')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2667 vim.options['rtp'] = old_rtp
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2668 del old_rtp
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2669 cb.append("> Options")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2670 cb.append(">> OptionsItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2671 ee('vim.options["abcQ"]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2672 ee('vim.options[""]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2673 stringtochars_test('vim.options[%s]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2674 cb.append(">> OptionsContains")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2675 stringtochars_test('%s in vim.options')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2676 cb.append("> Dictionary")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2677 cb.append(">> DictionaryConstructor")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2678 ee('vim.Dictionary("abcI")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2679 ##! Not checked: py_dict_alloc failure
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2680 cb.append(">> DictionarySetattr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2681 ee('del d.locked')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2682 ee('d.locked = FailingTrue()')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2683 ee('vim.vvars.locked = False')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2684 ee('d.scope = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2685 ee('d.xxx = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2686 cb.append(">> _DictionaryItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2687 ee('d.get("a", 2, 3)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2688 stringtochars_test('d.get(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2689 ee('d.pop("a")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2690 ee('dl.pop("a")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2691 cb.append(">> DictionaryContains")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2692 ee('"" in d')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2693 ee('0 in d')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2694 cb.append(">> DictionaryIterNext")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2695 ee('for i in ned: ned["a"] = 1')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2696 del i
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2697 cb.append(">> DictionaryAssItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2698 ee('dl["b"] = 1')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2699 stringtochars_test('d[%s] = 1')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2700 convertfrompyobject_test('d["a"] = %s')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2701 cb.append(">> DictionaryUpdate")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2702 cb.append(">>> kwargs")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2703 cb.append(">>> iter")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2704 ee('d.update(FailingMapping())')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2705 ee('d.update([FailingIterNext()])')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2706 ee('d.update([FailingIterNextN(1)])')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2707 iter_test('d.update(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2708 convertfrompyobject_test('d.update(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2709 stringtochars_test('d.update(((%s, 0),))')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2710 convertfrompyobject_test('d.update((("a", %s),))')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2711 cb.append(">> DictionaryPopItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2712 ee('d.popitem(1, 2)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2713 cb.append(">> DictionaryHasKey")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2714 ee('d.has_key()')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2715 cb.append("> List")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2716 cb.append(">> ListConstructor")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2717 ee('vim.List(1, 2)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2718 ee('vim.List(a=1)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2719 iter_test('vim.List(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2720 convertfrompyobject_test('vim.List([%s])')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2721 cb.append(">> ListItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2722 ee('l[1000]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2723 cb.append(">> ListAssItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2724 ee('ll[1] = 2')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2725 ee('l[1000] = 3')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2726 cb.append(">> ListAssSlice")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2727 ee('ll[1:100] = "abcJ"')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2728 iter_test('l[:] = %s')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2729 ee('nel[1:10:2] = "abcK"')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2730 cb.append(repr(tuple(nel)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2731 ee('nel[1:10:2] = "a"')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2732 cb.append(repr(tuple(nel)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2733 ee('nel[1:1:-1] = "a"')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2734 cb.append(repr(tuple(nel)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2735 ee('nel[:] = FailingIterNextN(2)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2736 cb.append(repr(tuple(nel)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2737 convertfrompyobject_test('l[:] = [%s]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2738 cb.append(">> ListConcatInPlace")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2739 iter_test('l.extend(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2740 convertfrompyobject_test('l.extend([%s])')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2741 cb.append(">> ListSetattr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2742 ee('del l.locked')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2743 ee('l.locked = FailingTrue()')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2744 ee('l.xxx = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2745 cb.append("> Function")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2746 cb.append(">> FunctionConstructor")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2747 cb.append(">>> FunctionConstructor")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2748 ee('vim.Function("123")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2749 ee('vim.Function("xxx_non_existent_function_xxx")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2750 ee('vim.Function("xxx#non#existent#function#xxx")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2751 ee('vim.Function("xxx_non_existent_function_xxx2", args=[])')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2752 ee('vim.Function("xxx_non_existent_function_xxx3", self={})')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2753 ee('vim.Function("xxx_non_existent_function_xxx4", args=[], self={})')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2754 cb.append(">>> FunctionNew")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2755 ee('vim.Function("tr", self="abcFuncSelf")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2756 ee('vim.Function("tr", args=427423)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2757 ee('vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2758 ee('vim.Function(self="abcFuncSelf2", args="abcFuncArgs2")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2759 ee('vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2760 ee('vim.Function("tr", "")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2761 cb.append(">> FunctionCall")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2762 convertfrompyobject_test('f(%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2763 convertfrompymapping_test('fd(self=%s)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2764 cb.append("> TabPage")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2765 cb.append(">> TabPageAttr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2766 ee('vim.current.tabpage.xxx')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2767 cb.append("> TabList")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2768 cb.append(">> TabListItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2769 ee('vim.tabpages[1000]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2770 cb.append("> Window")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2771 cb.append(">> WindowAttr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2772 ee('vim.current.window.xxx')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2773 cb.append(">> WindowSetattr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2774 ee('vim.current.window.buffer = 0')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2775 ee('vim.current.window.cursor = (100000000, 100000000)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2776 ee('vim.current.window.cursor = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2777 number_test('vim.current.window.height = %s', unsigned=True)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2778 number_test('vim.current.window.width = %s', unsigned=True)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2779 ee('vim.current.window.xxxxxx = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2780 cb.append("> WinList")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2781 cb.append(">> WinListItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2782 ee('vim.windows[1000]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2783 cb.append("> Buffer")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2784 cb.append(">> StringToLine (indirect)")
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
2785 ee('vim.current.buffer[0] = "\\na"')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2786 ee('vim.current.buffer[0] = u"\\na"')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2787 cb.append(">> SetBufferLine (indirect)")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2788 ee('vim.current.buffer[0] = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2789 cb.append(">> SetBufferLineList (indirect)")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2790 ee('vim.current.buffer[:] = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2791 ee('vim.current.buffer[:] = ["\\na", "bc"]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2792 cb.append(">> InsertBufferLines (indirect)")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2793 ee('vim.current.buffer.append(None)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2794 ee('vim.current.buffer.append(["\\na", "bc"])')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2795 ee('vim.current.buffer.append("\\nbc")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2796 cb.append(">> RBItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2797 ee('vim.current.buffer[100000000]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2798 cb.append(">> RBAsItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2799 ee('vim.current.buffer[100000000] = ""')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2800 cb.append(">> BufferAttr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2801 ee('vim.current.buffer.xxx')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2802 cb.append(">> BufferSetattr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2803 ee('vim.current.buffer.name = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2804 ee('vim.current.buffer.xxx = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2805 cb.append(">> BufferMark")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2806 ee('vim.current.buffer.mark(0)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2807 ee('vim.current.buffer.mark("abcM")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2808 ee('vim.current.buffer.mark("!")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2809 cb.append(">> BufferRange")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2810 ee('vim.current.buffer.range(1, 2, 3)')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2811 cb.append("> BufMap")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2812 cb.append(">> BufMapItem")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2813 ee('vim.buffers[100000000]')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2814 number_test('vim.buffers[%s]', natural=True)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2815 cb.append("> Current")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2816 cb.append(">> CurrentGetattr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2817 ee('vim.current.xxx')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2818 cb.append(">> CurrentSetattr")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2819 ee('vim.current.line = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2820 ee('vim.current.buffer = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2821 ee('vim.current.window = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2822 ee('vim.current.tabpage = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2823 ee('vim.current.xxx = True')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2824 del d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2825 del ned
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2826 del dl
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2827 del l
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2828 del ll
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2829 del nel
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2830 del f
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2831 del fd
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2832 del fdel
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2833 del subexpr_test
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2834 del stringtochars_test
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2835 del Mapping
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2836 del convertfrompyobject_test
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2837 del convertfrompymapping_test
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2838 del iter_test
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2839 del number_test
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2840 del FailingTrue
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2841 del FailingIter
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2842 del FailingIterNext
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2843 del FailingIterNextN
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2844 del FailingMapping
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2845 del FailingMappingKey
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2846 del FailingList
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2847 del NoArgsCall
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2848 del FailingCall
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2849 del FailingNumber
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2850 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2851 delfunction F
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2852
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2853 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2854 > Output
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2855 >> OutputSetattr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2856 del sys.stdout.softspace:AttributeError:('cannot delete OutputObject attributes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2857 >>> Testing NumberToLong using sys.stdout.softspace = %s
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2858 sys.stdout.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2859 sys.stdout.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2860 sys.stdout.softspace = -1:ValueError:('number must be greater or equal to zero',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2861 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2862 >>> Testing NumberToLong using sys.stderr.softspace = %s
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2863 sys.stderr.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2864 sys.stderr.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2865 sys.stderr.softspace = -1:ValueError:('number must be greater or equal to zero',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2866 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2867 assert sys.stdout.isatty()==False:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2868 assert sys.stdout.seekable()==False:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2869 sys.stdout.close():NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2870 sys.stdout.flush():NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2871 assert sys.stderr.isatty()==False:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2872 assert sys.stderr.seekable()==False:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2873 sys.stderr.close():NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2874 sys.stderr.flush():NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2875 sys.stdout.attr = None:AttributeError:('invalid attribute: attr',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2876 >> OutputWrite
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2877 assert sys.stdout.writable()==True:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2878 assert sys.stdout.readable()==False:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2879 assert sys.stderr.writable()==True:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2880 assert sys.stderr.readable()==False:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2881 assert sys.stdout.closed()==False:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2882 assert sys.stderr.closed()==False:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2883 assert sys.stdout.errors=="strict":NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2884 assert sys.stderr.errors=="strict":NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2885 assert sys.stdout.encoding==sys.stderr.encoding:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2886 sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2887 >> OutputWriteLines
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2888 sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2889 sys.stdout.writelines([1]):TypeError:('coercing to Unicode: need string or buffer, int found',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2890 >>> Testing *Iter* using sys.stdout.writelines(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2891 sys.stdout.writelines(FailingIter()):NotImplementedError:('iter',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2892 sys.stdout.writelines(FailingIterNext()):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2893 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2894 > VimCommand
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2895 >>> Testing StringToChars using vim.command(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2896 vim.command(1):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2897 vim.command(u"\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2898 vim.command("\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2899 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2900 vim.command("", 2):TypeError:('command() takes exactly one argument (2 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2901 > VimToPython
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2902 > VimEval
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2903 >>> Testing StringToChars using vim.eval(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2904 vim.eval(1):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2905 vim.eval(u"\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2906 vim.eval("\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2907 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2908 vim.eval("", FailingTrue()):TypeError:('function takes exactly 1 argument (2 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2909 > VimEvalPy
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2910 >>> Testing StringToChars using vim.bindeval(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2911 vim.bindeval(1):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2912 vim.bindeval(u"\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2913 vim.bindeval("\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2914 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2915 vim.eval("", 2):TypeError:('function takes exactly 1 argument (2 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2916 > VimStrwidth
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2917 >>> Testing StringToChars using vim.strwidth(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2918 vim.strwidth(1):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2919 vim.strwidth(u"\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2920 vim.strwidth("\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2921 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2922 > VimForeachRTP
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2923 vim.foreach_rtp(None):TypeError:("'NoneType' object is not callable",)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2924 vim.foreach_rtp(NoArgsCall()):TypeError:('__call__() takes exactly 1 argument (2 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2925 vim.foreach_rtp(FailingCall()):NotImplementedError:('call',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2926 vim.foreach_rtp(int, 2):TypeError:('foreach_rtp() takes exactly one argument (2 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2927 > import
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2928 import xxx_no_such_module_xxx:ImportError:('No module named xxx_no_such_module_xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2929 import failing_import:ImportError:()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2930 import failing:NotImplementedError:()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2931 > Options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2932 >> OptionsItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2933 vim.options["abcQ"]:KeyError:('abcQ',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2934 vim.options[""]:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2935 >>> Testing StringToChars using vim.options[%s]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2936 vim.options[1]:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2937 vim.options[u"\0"]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2938 vim.options["\0"]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2939 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2940 >> OptionsContains
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2941 >>> Testing StringToChars using %s in vim.options
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2942 1 in vim.options:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2943 u"\0" in vim.options:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2944 "\0" in vim.options:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2945 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2946 > Dictionary
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2947 >> DictionaryConstructor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2948 vim.Dictionary("abcI"):ValueError:('expected sequence element of size 2, but got sequence of size 1',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2949 >> DictionarySetattr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2950 del d.locked:AttributeError:('cannot delete vim.Dictionary attributes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2951 d.locked = FailingTrue():NotImplementedError:('bool',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2952 vim.vvars.locked = False:TypeError:('cannot modify fixed dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2953 d.scope = True:AttributeError:('cannot set attribute scope',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2954 d.xxx = True:AttributeError:('cannot set attribute xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2955 >> _DictionaryItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2956 d.get("a", 2, 3):TypeError:('function takes at most 2 arguments (3 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2957 >>> Testing StringToChars using d.get(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2958 d.get(1):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2959 d.get(u"\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2960 d.get("\0"):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2961 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2962 d.pop("a"):KeyError:('a',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2963 dl.pop("a"):error:('dictionary is locked',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2964 >> DictionaryContains
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2965 "" in d:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2966 0 in d:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2967 >> DictionaryIterNext
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2968 for i in ned: ned["a"] = 1:RuntimeError:('hashtab changed during iteration',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2969 >> DictionaryAssItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2970 dl["b"] = 1:error:('dictionary is locked',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2971 >>> Testing StringToChars using d[%s] = 1
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2972 d[1] = 1:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2973 d[u"\0"] = 1:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2974 d["\0"] = 1:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2975 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2976 >>> Testing StringToChars using d["a"] = {%s : 1}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2977 d["a"] = {1 : 1}:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2978 d["a"] = {u"\0" : 1}:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2979 d["a"] = {"\0" : 1}:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2980 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2981 >>> Testing StringToChars using d["a"] = {"abcF" : {%s : 1}}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2982 d["a"] = {"abcF" : {1 : 1}}:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2983 d["a"] = {"abcF" : {u"\0" : 1}}:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2984 d["a"] = {"abcF" : {"\0" : 1}}:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2985 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2986 >>> Testing StringToChars using d["a"] = {"abcF" : Mapping({%s : 1})}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2987 d["a"] = {"abcF" : Mapping({1 : 1})}:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2988 d["a"] = {"abcF" : Mapping({u"\0" : 1})}:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2989 d["a"] = {"abcF" : Mapping({"\0" : 1})}:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2990 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2991 >>> Testing *Iter* using d["a"] = {"abcF" : %s}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2992 d["a"] = {"abcF" : FailingIter()}:TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2993 d["a"] = {"abcF" : FailingIterNext()}:NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2994 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2995 >>> Testing ConvertFromPyObject using d["a"] = {"abcF" : %s}
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2996 d["a"] = {"abcF" : None}:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2997 d["a"] = {"abcF" : {"": 1}}:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2998 d["a"] = {"abcF" : {u"": 1}}:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
2999 d["a"] = {"abcF" : FailingMapping()}:NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3000 d["a"] = {"abcF" : FailingMappingKey()}:NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3001 d["a"] = {"abcF" : FailingNumber()}:TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3002 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3003 >>> Testing StringToChars using d["a"] = Mapping({%s : 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3004 d["a"] = Mapping({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3005 d["a"] = Mapping({u"\0" : 1}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3006 d["a"] = Mapping({"\0" : 1}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3007 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3008 >>> Testing StringToChars using d["a"] = Mapping({"abcG" : {%s : 1}})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3009 d["a"] = Mapping({"abcG" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3010 d["a"] = Mapping({"abcG" : {u"\0" : 1}}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3011 d["a"] = Mapping({"abcG" : {"\0" : 1}}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3012 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3013 >>> Testing StringToChars using d["a"] = Mapping({"abcG" : Mapping({%s : 1})})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3014 d["a"] = Mapping({"abcG" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3015 d["a"] = Mapping({"abcG" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3016 d["a"] = Mapping({"abcG" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3017 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3018 >>> Testing *Iter* using d["a"] = Mapping({"abcG" : %s})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3019 d["a"] = Mapping({"abcG" : FailingIter()}):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3020 d["a"] = Mapping({"abcG" : FailingIterNext()}):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3021 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3022 >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abcG" : %s})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3023 d["a"] = Mapping({"abcG" : None}):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3024 d["a"] = Mapping({"abcG" : {"": 1}}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3025 d["a"] = Mapping({"abcG" : {u"": 1}}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3026 d["a"] = Mapping({"abcG" : FailingMapping()}):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3027 d["a"] = Mapping({"abcG" : FailingMappingKey()}):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3028 d["a"] = Mapping({"abcG" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3029 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3030 >>> Testing *Iter* using d["a"] = %s
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3031 d["a"] = FailingIter():TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3032 d["a"] = FailingIterNext():NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3033 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3034 >>> Testing ConvertFromPyObject using d["a"] = %s
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3035 d["a"] = None:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3036 d["a"] = {"": 1}:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3037 d["a"] = {u"": 1}:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3038 d["a"] = FailingMapping():NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3039 d["a"] = FailingMappingKey():NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3040 d["a"] = FailingNumber():TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3041 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3042 >> DictionaryUpdate
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3043 >>> kwargs
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3044 >>> iter
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3045 d.update(FailingMapping()):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3046 d.update([FailingIterNext()]):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3047 d.update([FailingIterNextN(1)]):NotImplementedError:('next N',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3048 >>> Testing *Iter* using d.update(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3049 d.update(FailingIter()):NotImplementedError:('iter',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3050 d.update(FailingIterNext()):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3051 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3052 >>> Testing StringToChars using d.update({%s : 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3053 d.update({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3054 d.update({u"\0" : 1}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3055 d.update({"\0" : 1}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3056 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3057 >>> Testing StringToChars using d.update({"abcF" : {%s : 1}})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3058 d.update({"abcF" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3059 d.update({"abcF" : {u"\0" : 1}}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3060 d.update({"abcF" : {"\0" : 1}}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3061 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3062 >>> Testing StringToChars using d.update({"abcF" : Mapping({%s : 1})})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3063 d.update({"abcF" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3064 d.update({"abcF" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3065 d.update({"abcF" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3066 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3067 >>> Testing *Iter* using d.update({"abcF" : %s})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3068 d.update({"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3069 d.update({"abcF" : FailingIterNext()}):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3070 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3071 >>> Testing ConvertFromPyObject using d.update({"abcF" : %s})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3072 d.update({"abcF" : None}):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3073 d.update({"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3074 d.update({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3075 d.update({"abcF" : FailingMapping()}):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3076 d.update({"abcF" : FailingMappingKey()}):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3077 d.update({"abcF" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3078 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3079 >>> Testing StringToChars using d.update(Mapping({%s : 1}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3080 d.update(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3081 d.update(Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3082 d.update(Mapping({"\0" : 1})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3083 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3084 >>> Testing StringToChars using d.update(Mapping({"abcG" : {%s : 1}}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3085 d.update(Mapping({"abcG" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3086 d.update(Mapping({"abcG" : {u"\0" : 1}})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3087 d.update(Mapping({"abcG" : {"\0" : 1}})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3088 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3089 >>> Testing StringToChars using d.update(Mapping({"abcG" : Mapping({%s : 1})}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3090 d.update(Mapping({"abcG" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3091 d.update(Mapping({"abcG" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3092 d.update(Mapping({"abcG" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3093 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3094 >>> Testing *Iter* using d.update(Mapping({"abcG" : %s}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3095 d.update(Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3096 d.update(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3097 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3098 >>> Testing ConvertFromPyObject using d.update(Mapping({"abcG" : %s}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3099 d.update(Mapping({"abcG" : None})):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3100 d.update(Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3101 d.update(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3102 d.update(Mapping({"abcG" : FailingMapping()})):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3103 d.update(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3104 d.update(Mapping({"abcG" : FailingNumber()})):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3105 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3106 >>> Testing *Iter* using d.update(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3107 d.update(FailingIter()):NotImplementedError:('iter',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3108 d.update(FailingIterNext()):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3109 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3110 >>> Testing ConvertFromPyObject using d.update(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3111 d.update(None):TypeError:("'NoneType' object is not iterable",)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3112 d.update({"": 1}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3113 d.update({u"": 1}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3114 d.update(FailingMapping()):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3115 d.update(FailingMappingKey()):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3116 d.update(FailingNumber()):TypeError:("'FailingNumber' object is not iterable",)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3117 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3118 >>> Testing StringToChars using d.update(((%s, 0),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3119 d.update(((1, 0),)):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3120 d.update(((u"\0", 0),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3121 d.update((("\0", 0),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3122 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3123 >>> Testing StringToChars using d.update((("a", {%s : 1}),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3124 d.update((("a", {1 : 1}),)):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3125 d.update((("a", {u"\0" : 1}),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3126 d.update((("a", {"\0" : 1}),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3127 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3128 >>> Testing StringToChars using d.update((("a", {"abcF" : {%s : 1}}),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3129 d.update((("a", {"abcF" : {1 : 1}}),)):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3130 d.update((("a", {"abcF" : {u"\0" : 1}}),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3131 d.update((("a", {"abcF" : {"\0" : 1}}),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3132 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3133 >>> Testing StringToChars using d.update((("a", {"abcF" : Mapping({%s : 1})}),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3134 d.update((("a", {"abcF" : Mapping({1 : 1})}),)):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3135 d.update((("a", {"abcF" : Mapping({u"\0" : 1})}),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3136 d.update((("a", {"abcF" : Mapping({"\0" : 1})}),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3137 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3138 >>> Testing *Iter* using d.update((("a", {"abcF" : %s}),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3139 d.update((("a", {"abcF" : FailingIter()}),)):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3140 d.update((("a", {"abcF" : FailingIterNext()}),)):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3141 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3142 >>> Testing ConvertFromPyObject using d.update((("a", {"abcF" : %s}),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3143 d.update((("a", {"abcF" : None}),)):error:("failed to add key 'a' to dictionary",)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3144 d.update((("a", {"abcF" : {"": 1}}),)):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3145 d.update((("a", {"abcF" : {u"": 1}}),)):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3146 d.update((("a", {"abcF" : FailingMapping()}),)):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3147 d.update((("a", {"abcF" : FailingMappingKey()}),)):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3148 d.update((("a", {"abcF" : FailingNumber()}),)):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3149 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3150 >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3151 d.update((("a", Mapping({1 : 1})),)):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3152 d.update((("a", Mapping({u"\0" : 1})),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3153 d.update((("a", Mapping({"\0" : 1})),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3154 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3155 >>> Testing StringToChars using d.update((("a", Mapping({"abcG" : {%s : 1}})),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3156 d.update((("a", Mapping({"abcG" : {1 : 1}})),)):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3157 d.update((("a", Mapping({"abcG" : {u"\0" : 1}})),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3158 d.update((("a", Mapping({"abcG" : {"\0" : 1}})),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3159 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3160 >>> Testing StringToChars using d.update((("a", Mapping({"abcG" : Mapping({%s : 1})})),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3161 d.update((("a", Mapping({"abcG" : Mapping({1 : 1})})),)):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3162 d.update((("a", Mapping({"abcG" : Mapping({u"\0" : 1})})),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3163 d.update((("a", Mapping({"abcG" : Mapping({"\0" : 1})})),)):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3164 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3165 >>> Testing *Iter* using d.update((("a", Mapping({"abcG" : %s})),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3166 d.update((("a", Mapping({"abcG" : FailingIter()})),)):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3167 d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3168 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3169 >>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abcG" : %s})),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3170 d.update((("a", Mapping({"abcG" : None})),)):error:("failed to add key 'a' to dictionary",)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3171 d.update((("a", Mapping({"abcG" : {"": 1}})),)):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3172 d.update((("a", Mapping({"abcG" : {u"": 1}})),)):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3173 d.update((("a", Mapping({"abcG" : FailingMapping()})),)):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3174 d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3175 d.update((("a", Mapping({"abcG" : FailingNumber()})),)):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3176 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3177 >>> Testing *Iter* using d.update((("a", %s),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3178 d.update((("a", FailingIter()),)):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3179 d.update((("a", FailingIterNext()),)):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3180 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3181 >>> Testing ConvertFromPyObject using d.update((("a", %s),))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3182 d.update((("a", None),)):error:("failed to add key 'a' to dictionary",)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3183 d.update((("a", {"": 1}),)):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3184 d.update((("a", {u"": 1}),)):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3185 d.update((("a", FailingMapping()),)):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3186 d.update((("a", FailingMappingKey()),)):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3187 d.update((("a", FailingNumber()),)):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3188 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3189 >> DictionaryPopItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3190 d.popitem(1, 2):TypeError:('popitem() takes no arguments (2 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3191 >> DictionaryHasKey
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3192 d.has_key():TypeError:('has_key() takes exactly one argument (0 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3193 > List
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3194 >> ListConstructor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3195 vim.List(1, 2):TypeError:('function takes at most 1 argument (2 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3196 vim.List(a=1):TypeError:('list constructor does not accept keyword arguments',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3197 >>> Testing *Iter* using vim.List(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3198 vim.List(FailingIter()):NotImplementedError:('iter',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3199 vim.List(FailingIterNext()):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3200 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3201 >>> Testing StringToChars using vim.List([{%s : 1}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3202 vim.List([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3203 vim.List([{u"\0" : 1}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3204 vim.List([{"\0" : 1}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3205 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3206 >>> Testing StringToChars using vim.List([{"abcF" : {%s : 1}}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3207 vim.List([{"abcF" : {1 : 1}}]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3208 vim.List([{"abcF" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3209 vim.List([{"abcF" : {"\0" : 1}}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3210 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3211 >>> Testing StringToChars using vim.List([{"abcF" : Mapping({%s : 1})}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3212 vim.List([{"abcF" : Mapping({1 : 1})}]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3213 vim.List([{"abcF" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3214 vim.List([{"abcF" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3215 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3216 >>> Testing *Iter* using vim.List([{"abcF" : %s}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3217 vim.List([{"abcF" : FailingIter()}]):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3218 vim.List([{"abcF" : FailingIterNext()}]):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3219 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3220 >>> Testing ConvertFromPyObject using vim.List([{"abcF" : %s}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3221 vim.List([{"abcF" : None}]):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3222 vim.List([{"abcF" : {"": 1}}]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3223 vim.List([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3224 vim.List([{"abcF" : FailingMapping()}]):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3225 vim.List([{"abcF" : FailingMappingKey()}]):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3226 vim.List([{"abcF" : FailingNumber()}]):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3227 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3228 >>> Testing StringToChars using vim.List([Mapping({%s : 1})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3229 vim.List([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3230 vim.List([Mapping({u"\0" : 1})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3231 vim.List([Mapping({"\0" : 1})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3232 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3233 >>> Testing StringToChars using vim.List([Mapping({"abcG" : {%s : 1}})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3234 vim.List([Mapping({"abcG" : {1 : 1}})]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3235 vim.List([Mapping({"abcG" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3236 vim.List([Mapping({"abcG" : {"\0" : 1}})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3237 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3238 >>> Testing StringToChars using vim.List([Mapping({"abcG" : Mapping({%s : 1})})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3239 vim.List([Mapping({"abcG" : Mapping({1 : 1})})]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3240 vim.List([Mapping({"abcG" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3241 vim.List([Mapping({"abcG" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3242 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3243 >>> Testing *Iter* using vim.List([Mapping({"abcG" : %s})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3244 vim.List([Mapping({"abcG" : FailingIter()})]):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3245 vim.List([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3246 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3247 >>> Testing ConvertFromPyObject using vim.List([Mapping({"abcG" : %s})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3248 vim.List([Mapping({"abcG" : None})]):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3249 vim.List([Mapping({"abcG" : {"": 1}})]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3250 vim.List([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3251 vim.List([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3252 vim.List([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3253 vim.List([Mapping({"abcG" : FailingNumber()})]):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3254 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3255 >>> Testing *Iter* using vim.List([%s])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3256 vim.List([FailingIter()]):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3257 vim.List([FailingIterNext()]):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3258 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3259 >>> Testing ConvertFromPyObject using vim.List([%s])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3260 vim.List([None]):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3261 vim.List([{"": 1}]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3262 vim.List([{u"": 1}]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3263 vim.List([FailingMapping()]):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3264 vim.List([FailingMappingKey()]):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3265 vim.List([FailingNumber()]):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3266 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3267 >> ListItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3268 l[1000]:IndexError:('list index out of range',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3269 >> ListAssItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3270 ll[1] = 2:error:('list is locked',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3271 l[1000] = 3:IndexError:('list index out of range',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3272 >> ListAssSlice
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3273 ll[1:100] = "abcJ":error:('list is locked',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3274 >>> Testing *Iter* using l[:] = %s
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3275 l[:] = FailingIter():NotImplementedError:('iter',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3276 l[:] = FailingIterNext():NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3277 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3278 nel[1:10:2] = "abcK":ValueError:('attempt to assign sequence of size greater than 2 to extended slice',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3279 ('a', 'b', 'c', 'O')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3280 nel[1:10:2] = "a":ValueError:('attempt to assign sequence of size 1 to extended slice of size 2',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3281 ('a', 'b', 'c', 'O')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3282 nel[1:1:-1] = "a":ValueError:('attempt to assign sequence of size greater than 0 to extended slice',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3283 ('a', 'b', 'c', 'O')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3284 nel[:] = FailingIterNextN(2):NotImplementedError:('next N',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3285 ('a', 'b', 'c', 'O')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3286 >>> Testing StringToChars using l[:] = [{%s : 1}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3287 l[:] = [{1 : 1}]:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3288 l[:] = [{u"\0" : 1}]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3289 l[:] = [{"\0" : 1}]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3290 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3291 >>> Testing StringToChars using l[:] = [{"abcF" : {%s : 1}}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3292 l[:] = [{"abcF" : {1 : 1}}]:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3293 l[:] = [{"abcF" : {u"\0" : 1}}]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3294 l[:] = [{"abcF" : {"\0" : 1}}]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3295 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3296 >>> Testing StringToChars using l[:] = [{"abcF" : Mapping({%s : 1})}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3297 l[:] = [{"abcF" : Mapping({1 : 1})}]:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3298 l[:] = [{"abcF" : Mapping({u"\0" : 1})}]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3299 l[:] = [{"abcF" : Mapping({"\0" : 1})}]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3300 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3301 >>> Testing *Iter* using l[:] = [{"abcF" : %s}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3302 l[:] = [{"abcF" : FailingIter()}]:TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3303 l[:] = [{"abcF" : FailingIterNext()}]:NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3304 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3305 >>> Testing ConvertFromPyObject using l[:] = [{"abcF" : %s}]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3306 l[:] = [{"abcF" : None}]:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3307 l[:] = [{"abcF" : {"": 1}}]:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3308 l[:] = [{"abcF" : {u"": 1}}]:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3309 l[:] = [{"abcF" : FailingMapping()}]:NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3310 l[:] = [{"abcF" : FailingMappingKey()}]:NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3311 l[:] = [{"abcF" : FailingNumber()}]:TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3312 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3313 >>> Testing StringToChars using l[:] = [Mapping({%s : 1})]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3314 l[:] = [Mapping({1 : 1})]:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3315 l[:] = [Mapping({u"\0" : 1})]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3316 l[:] = [Mapping({"\0" : 1})]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3317 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3318 >>> Testing StringToChars using l[:] = [Mapping({"abcG" : {%s : 1}})]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3319 l[:] = [Mapping({"abcG" : {1 : 1}})]:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3320 l[:] = [Mapping({"abcG" : {u"\0" : 1}})]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3321 l[:] = [Mapping({"abcG" : {"\0" : 1}})]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3322 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3323 >>> Testing StringToChars using l[:] = [Mapping({"abcG" : Mapping({%s : 1})})]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3324 l[:] = [Mapping({"abcG" : Mapping({1 : 1})})]:TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3325 l[:] = [Mapping({"abcG" : Mapping({u"\0" : 1})})]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3326 l[:] = [Mapping({"abcG" : Mapping({"\0" : 1})})]:TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3327 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3328 >>> Testing *Iter* using l[:] = [Mapping({"abcG" : %s})]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3329 l[:] = [Mapping({"abcG" : FailingIter()})]:TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3330 l[:] = [Mapping({"abcG" : FailingIterNext()})]:NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3331 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3332 >>> Testing ConvertFromPyObject using l[:] = [Mapping({"abcG" : %s})]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3333 l[:] = [Mapping({"abcG" : None})]:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3334 l[:] = [Mapping({"abcG" : {"": 1}})]:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3335 l[:] = [Mapping({"abcG" : {u"": 1}})]:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3336 l[:] = [Mapping({"abcG" : FailingMapping()})]:NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3337 l[:] = [Mapping({"abcG" : FailingMappingKey()})]:NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3338 l[:] = [Mapping({"abcG" : FailingNumber()})]:TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3339 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3340 >>> Testing *Iter* using l[:] = [%s]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3341 l[:] = [FailingIter()]:TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3342 l[:] = [FailingIterNext()]:NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3343 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3344 >>> Testing ConvertFromPyObject using l[:] = [%s]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3345 l[:] = [None]:NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3346 l[:] = [{"": 1}]:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3347 l[:] = [{u"": 1}]:ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3348 l[:] = [FailingMapping()]:NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3349 l[:] = [FailingMappingKey()]:NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3350 l[:] = [FailingNumber()]:TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3351 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3352 >> ListConcatInPlace
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3353 >>> Testing *Iter* using l.extend(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3354 l.extend(FailingIter()):NotImplementedError:('iter',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3355 l.extend(FailingIterNext()):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3356 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3357 >>> Testing StringToChars using l.extend([{%s : 1}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3358 l.extend([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3359 l.extend([{u"\0" : 1}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3360 l.extend([{"\0" : 1}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3361 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3362 >>> Testing StringToChars using l.extend([{"abcF" : {%s : 1}}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3363 l.extend([{"abcF" : {1 : 1}}]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3364 l.extend([{"abcF" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3365 l.extend([{"abcF" : {"\0" : 1}}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3366 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3367 >>> Testing StringToChars using l.extend([{"abcF" : Mapping({%s : 1})}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3368 l.extend([{"abcF" : Mapping({1 : 1})}]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3369 l.extend([{"abcF" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3370 l.extend([{"abcF" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3371 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3372 >>> Testing *Iter* using l.extend([{"abcF" : %s}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3373 l.extend([{"abcF" : FailingIter()}]):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3374 l.extend([{"abcF" : FailingIterNext()}]):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3375 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3376 >>> Testing ConvertFromPyObject using l.extend([{"abcF" : %s}])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3377 l.extend([{"abcF" : None}]):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3378 l.extend([{"abcF" : {"": 1}}]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3379 l.extend([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3380 l.extend([{"abcF" : FailingMapping()}]):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3381 l.extend([{"abcF" : FailingMappingKey()}]):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3382 l.extend([{"abcF" : FailingNumber()}]):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3383 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3384 >>> Testing StringToChars using l.extend([Mapping({%s : 1})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3385 l.extend([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3386 l.extend([Mapping({u"\0" : 1})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3387 l.extend([Mapping({"\0" : 1})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3388 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3389 >>> Testing StringToChars using l.extend([Mapping({"abcG" : {%s : 1}})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3390 l.extend([Mapping({"abcG" : {1 : 1}})]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3391 l.extend([Mapping({"abcG" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3392 l.extend([Mapping({"abcG" : {"\0" : 1}})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3393 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3394 >>> Testing StringToChars using l.extend([Mapping({"abcG" : Mapping({%s : 1})})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3395 l.extend([Mapping({"abcG" : Mapping({1 : 1})})]):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3396 l.extend([Mapping({"abcG" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3397 l.extend([Mapping({"abcG" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3398 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3399 >>> Testing *Iter* using l.extend([Mapping({"abcG" : %s})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3400 l.extend([Mapping({"abcG" : FailingIter()})]):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3401 l.extend([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3402 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3403 >>> Testing ConvertFromPyObject using l.extend([Mapping({"abcG" : %s})])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3404 l.extend([Mapping({"abcG" : None})]):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3405 l.extend([Mapping({"abcG" : {"": 1}})]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3406 l.extend([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3407 l.extend([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3408 l.extend([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3409 l.extend([Mapping({"abcG" : FailingNumber()})]):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3410 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3411 >>> Testing *Iter* using l.extend([%s])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3412 l.extend([FailingIter()]):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3413 l.extend([FailingIterNext()]):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3414 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3415 >>> Testing ConvertFromPyObject using l.extend([%s])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3416 l.extend([None]):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3417 l.extend([{"": 1}]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3418 l.extend([{u"": 1}]):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3419 l.extend([FailingMapping()]):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3420 l.extend([FailingMappingKey()]):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3421 l.extend([FailingNumber()]):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3422 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3423 >> ListSetattr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3424 del l.locked:AttributeError:('cannot delete vim.List attributes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3425 l.locked = FailingTrue():NotImplementedError:('bool',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3426 l.xxx = True:AttributeError:('cannot set attribute xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3427 > Function
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3428 >> FunctionConstructor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3429 >>> FunctionConstructor
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3430 vim.Function("123"):ValueError:('unnamed function 123 does not exist',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3431 vim.Function("xxx_non_existent_function_xxx"):ValueError:('function xxx_non_existent_function_xxx does not exist',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3432 vim.Function("xxx#non#existent#function#xxx"):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3433 vim.Function("xxx_non_existent_function_xxx2", args=[]):ValueError:('function xxx_non_existent_function_xxx2 does not exist',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3434 vim.Function("xxx_non_existent_function_xxx3", self={}):ValueError:('function xxx_non_existent_function_xxx3 does not exist',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3435 vim.Function("xxx_non_existent_function_xxx4", args=[], self={}):ValueError:('function xxx_non_existent_function_xxx4 does not exist',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3436 >>> FunctionNew
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3437 vim.Function("tr", self="abcFuncSelf"):TypeError:('unable to convert str to a Vim dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3438 vim.Function("tr", args=427423):TypeError:('unable to convert int to a Vim list',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3439 vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2"):TypeError:('unable to convert str to a Vim dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3440 vim.Function(self="abcFuncSelf2", args="abcFuncArgs2"):TypeError:('unable to convert str to a Vim dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3441 vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2"):TypeError:('unable to convert str to a Vim dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3442 vim.Function("tr", ""):TypeError:('function takes exactly 1 argument (2 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3443 >> FunctionCall
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3444 >>> Testing StringToChars using f({%s : 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3445 f({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3446 f({u"\0" : 1}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3447 f({"\0" : 1}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3448 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3449 >>> Testing StringToChars using f({"abcF" : {%s : 1}})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3450 f({"abcF" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3451 f({"abcF" : {u"\0" : 1}}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3452 f({"abcF" : {"\0" : 1}}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3453 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3454 >>> Testing StringToChars using f({"abcF" : Mapping({%s : 1})})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3455 f({"abcF" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3456 f({"abcF" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3457 f({"abcF" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3458 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3459 >>> Testing *Iter* using f({"abcF" : %s})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3460 f({"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3461 f({"abcF" : FailingIterNext()}):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3462 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3463 >>> Testing ConvertFromPyObject using f({"abcF" : %s})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3464 f({"abcF" : None}):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3465 f({"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3466 f({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3467 f({"abcF" : FailingMapping()}):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3468 f({"abcF" : FailingMappingKey()}):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3469 f({"abcF" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3470 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3471 >>> Testing StringToChars using f(Mapping({%s : 1}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3472 f(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3473 f(Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3474 f(Mapping({"\0" : 1})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3475 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3476 >>> Testing StringToChars using f(Mapping({"abcG" : {%s : 1}}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3477 f(Mapping({"abcG" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3478 f(Mapping({"abcG" : {u"\0" : 1}})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3479 f(Mapping({"abcG" : {"\0" : 1}})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3480 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3481 >>> Testing StringToChars using f(Mapping({"abcG" : Mapping({%s : 1})}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3482 f(Mapping({"abcG" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3483 f(Mapping({"abcG" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3484 f(Mapping({"abcG" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3485 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3486 >>> Testing *Iter* using f(Mapping({"abcG" : %s}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3487 f(Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3488 f(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3489 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3490 >>> Testing ConvertFromPyObject using f(Mapping({"abcG" : %s}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3491 f(Mapping({"abcG" : None})):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3492 f(Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3493 f(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3494 f(Mapping({"abcG" : FailingMapping()})):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3495 f(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3496 f(Mapping({"abcG" : FailingNumber()})):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3497 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3498 >>> Testing *Iter* using f(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3499 f(FailingIter()):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3500 f(FailingIterNext()):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3501 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3502 >>> Testing ConvertFromPyObject using f(%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3503 f(None):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3504 f({"": 1}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3505 f({u"": 1}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3506 f(FailingMapping()):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3507 f(FailingMappingKey()):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3508 f(FailingNumber()):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3509 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3510 >>> Testing StringToChars using fd(self={%s : 1})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3511 fd(self={1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3512 fd(self={u"\0" : 1}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3513 fd(self={"\0" : 1}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3514 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3515 >>> Testing StringToChars using fd(self={"abcF" : {%s : 1}})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3516 fd(self={"abcF" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3517 fd(self={"abcF" : {u"\0" : 1}}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3518 fd(self={"abcF" : {"\0" : 1}}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3519 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3520 >>> Testing StringToChars using fd(self={"abcF" : Mapping({%s : 1})})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3521 fd(self={"abcF" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3522 fd(self={"abcF" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3523 fd(self={"abcF" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3524 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3525 >>> Testing *Iter* using fd(self={"abcF" : %s})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3526 fd(self={"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3527 fd(self={"abcF" : FailingIterNext()}):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3528 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3529 >>> Testing ConvertFromPyObject using fd(self={"abcF" : %s})
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3530 fd(self={"abcF" : None}):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3531 fd(self={"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3532 fd(self={"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3533 fd(self={"abcF" : FailingMapping()}):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3534 fd(self={"abcF" : FailingMappingKey()}):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3535 fd(self={"abcF" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3536 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3537 >>> Testing StringToChars using fd(self=Mapping({%s : 1}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3538 fd(self=Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3539 fd(self=Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3540 fd(self=Mapping({"\0" : 1})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3541 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3542 >>> Testing StringToChars using fd(self=Mapping({"abcG" : {%s : 1}}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3543 fd(self=Mapping({"abcG" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3544 fd(self=Mapping({"abcG" : {u"\0" : 1}})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3545 fd(self=Mapping({"abcG" : {"\0" : 1}})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3546 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3547 >>> Testing StringToChars using fd(self=Mapping({"abcG" : Mapping({%s : 1})}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3548 fd(self=Mapping({"abcG" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3549 fd(self=Mapping({"abcG" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3550 fd(self=Mapping({"abcG" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3551 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3552 >>> Testing *Iter* using fd(self=Mapping({"abcG" : %s}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3553 fd(self=Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter to a Vim structure',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3554 fd(self=Mapping({"abcG" : FailingIterNext()})):NotImplementedError:('next',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3555 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3556 >>> Testing ConvertFromPyObject using fd(self=Mapping({"abcG" : %s}))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3557 fd(self=Mapping({"abcG" : None})):NOT FAILED
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3558 fd(self=Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3559 fd(self=Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3560 fd(self=Mapping({"abcG" : FailingMapping()})):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3561 fd(self=Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3562 fd(self=Mapping({"abcG" : FailingNumber()})):TypeError:('long() argument must be a string or a number',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3563 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3564 >>> Testing *Iter* using fd(self=%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3565 fd(self=FailingIter()):TypeError:('unable to convert FailingIter to a Vim dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3566 fd(self=FailingIterNext()):TypeError:('unable to convert FailingIterNext to a Vim dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3567 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3568 >>> Testing ConvertFromPyObject using fd(self=%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3569 fd(self=None):TypeError:('unable to convert NoneType to a Vim dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3570 fd(self={"": 1}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3571 fd(self={u"": 1}):ValueError:('empty keys are not allowed',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3572 fd(self=FailingMapping()):NotImplementedError:('keys',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3573 fd(self=FailingMappingKey()):NotImplementedError:('getitem:mappingkey',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3574 fd(self=FailingNumber()):TypeError:('unable to convert FailingNumber to a Vim dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3575 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3576 >>> Testing ConvertFromPyMapping using fd(self=%s)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3577 fd(self=[]):TypeError:('unable to convert list to a Vim dictionary',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3578 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3579 > TabPage
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3580 >> TabPageAttr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3581 vim.current.tabpage.xxx:AttributeError:('xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3582 > TabList
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3583 >> TabListItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3584 vim.tabpages[1000]:IndexError:('no such tab page',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3585 > Window
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3586 >> WindowAttr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3587 vim.current.window.xxx:AttributeError:('xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3588 >> WindowSetattr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3589 vim.current.window.buffer = 0:TypeError:('readonly attribute: buffer',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3590 vim.current.window.cursor = (100000000, 100000000):error:('cursor position outside buffer',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3591 vim.current.window.cursor = True:TypeError:('argument must be 2-item sequence, not bool',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3592 >>> Testing NumberToLong using vim.current.window.height = %s
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3593 vim.current.window.height = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3594 vim.current.window.height = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3595 vim.current.window.height = -1:ValueError:('number must be greater or equal to zero',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3596 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3597 >>> Testing NumberToLong using vim.current.window.width = %s
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3598 vim.current.window.width = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3599 vim.current.window.width = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3600 vim.current.window.width = -1:ValueError:('number must be greater or equal to zero',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3601 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3602 vim.current.window.xxxxxx = True:AttributeError:('xxxxxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3603 > WinList
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3604 >> WinListItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3605 vim.windows[1000]:IndexError:('no such window',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3606 > Buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3607 >> StringToLine (indirect)
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
3608 vim.current.buffer[0] = "\na":error:('string cannot contain newlines',)
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3609 vim.current.buffer[0] = u"\na":error:('string cannot contain newlines',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3610 >> SetBufferLine (indirect)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3611 vim.current.buffer[0] = True:TypeError:('bad argument type for built-in operation',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3612 >> SetBufferLineList (indirect)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3613 vim.current.buffer[:] = True:TypeError:('bad argument type for built-in operation',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3614 vim.current.buffer[:] = ["\na", "bc"]:error:('string cannot contain newlines',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3615 >> InsertBufferLines (indirect)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3616 vim.current.buffer.append(None):TypeError:('bad argument type for built-in operation',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3617 vim.current.buffer.append(["\na", "bc"]):error:('string cannot contain newlines',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3618 vim.current.buffer.append("\nbc"):error:('string cannot contain newlines',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3619 >> RBItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3620 vim.current.buffer[100000000]:IndexError:('line number out of range',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3621 >> RBAsItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3622 vim.current.buffer[100000000] = "":IndexError:('line number out of range',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3623 >> BufferAttr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3624 vim.current.buffer.xxx:AttributeError:('xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3625 >> BufferSetattr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3626 vim.current.buffer.name = True:TypeError:('expected str() or unicode() instance, but got bool',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3627 vim.current.buffer.xxx = True:AttributeError:('xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3628 >> BufferMark
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3629 vim.current.buffer.mark(0):TypeError:('expected str() or unicode() instance, but got int',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3630 vim.current.buffer.mark("abcM"):ValueError:('mark name must be a single character',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3631 vim.current.buffer.mark("!"):error:('invalid mark name',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3632 >> BufferRange
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3633 vim.current.buffer.range(1, 2, 3):TypeError:('function takes exactly 2 arguments (3 given)',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3634 > BufMap
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3635 >> BufMapItem
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3636 vim.buffers[100000000]:KeyError:(100000000,)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3637 >>> Testing NumberToLong using vim.buffers[%s]
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3638 vim.buffers[[]]:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3639 vim.buffers[None]:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3640 vim.buffers[-1]:ValueError:('number must be greater than zero',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3641 vim.buffers[0]:ValueError:('number must be greater than zero',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3642 <<< Finished
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3643 > Current
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3644 >> CurrentGetattr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3645 vim.current.xxx:AttributeError:('xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3646 >> CurrentSetattr
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3647 vim.current.line = True:TypeError:('bad argument type for built-in operation',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3648 vim.current.buffer = True:TypeError:('expected vim.Buffer object, but got bool',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3649 vim.current.window = True:TypeError:('expected vim.Window object, but got bool',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3650 vim.current.tabpage = True:TypeError:('expected vim.TabPage object, but got bool',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3651 vim.current.xxx = True:AttributeError:('xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3652 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3653
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3654 call assert_equal(expected, getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3655 close!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3656 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3657
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3658 " Test import
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3659 func Test_python_import()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3660 new
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3661 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3662
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3663 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3664 sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3665 sys.path.append(os.path.join(os.getcwd(), 'python_after'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3666 vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3667 l = []
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3668 def callback(path):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3669 l.append(path[-len('/testdir'):].replace(os.path.sep, '/'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3670 vim.foreach_rtp(callback)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3671 cb.append(repr(l))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3672 del l
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3673 def callback(path):
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3674 return path[-len('/testdir'):].replace(os.path.sep, '/')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3675 cb.append(repr(vim.foreach_rtp(callback)))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3676 del callback
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3677 from module import dir as d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3678 from modulex import ddir
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3679 cb.append(d + ',' + ddir)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3680 import before
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3681 cb.append(before.dir)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3682 import after
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3683 cb.append(after.dir)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3684 import topmodule as tm
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3685 import topmodule.submodule as tms
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3686 import topmodule.submodule.subsubmodule.subsubsubmodule as tmsss
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3687 cb.append(tm.__file__.replace('.pyc', '.py').replace(os.path.sep, '/')[-len('modulex/topmodule/__init__.py'):])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3688 cb.append(tms.__file__.replace('.pyc', '.py').replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/__init__.py'):])
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3689 cb.append(tmsss.__file__.replace('.pyc', '.py').replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/subsubmodule/subsubsubmodule.py'):])
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
3690
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3691 del before
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3692 del after
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3693 del d
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3694 del ddir
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3695 del tm
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3696 del tms
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3697 del tmsss
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3698 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3699
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3700 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3701 ['/testdir']
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3702 '/testdir'
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3703 2,xx
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3704 before
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3705 after
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3706 pythonx/topmodule/__init__.py
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3707 pythonx/topmodule/submodule/__init__.py
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3708 pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3709 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3710 call assert_equal(expected, getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3711 close!
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
3712
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 22806
diff changeset
3713 " Try to import a non-existing module with a dot (.)
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
3714 call AssertException(['py import a.b.c'], 'ImportError:')
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3715 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3716
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3717 " Test exceptions
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3718 func Test_python_exception()
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
3719 func Exe(e)
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3720 execute a:e
21190
10eb6c38938c patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents: 21144
diff changeset
3721 endfunc
21138
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3722
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3723 new
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3724 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3725
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3726 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3727 Exe = vim.bindeval('function("Exe")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3728 ee('vim.command("throw \'abcN\'")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3729 ee('Exe("throw \'def\'")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3730 ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3731 ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3732 ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3733 ee('vim.eval("xxx_unknown_function_xxx()")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3734 ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3735 del Exe
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3736 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3737 delfunction Exe
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3738
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3739 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3740 vim.command("throw 'abcN'"):error:('abcN',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3741 Exe("throw 'def'"):error:('def',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3742 vim.eval("Exe('throw ''ghi''')"):error:('ghi',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3743 vim.eval("Exe('echoerr ''jkl''')"):error:('Vim(echoerr):jkl',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3744 vim.eval("Exe('xxx_non_existent_command_xxx')"):error:('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3745 vim.eval("xxx_unknown_function_xxx()"):error:('Vim:E117: Unknown function: xxx_unknown_function_xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3746 vim.bindeval("Exe('xxx_non_existent_command_xxx')"):error:('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3747 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3748 call assert_equal(expected, getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3749 close!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3750 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3751
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3752 " Regression: interrupting vim.command propagates to next vim.command
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3753 func Test_python_keyboard_interrupt()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3754 new
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3755 py cb = vim.current.buffer
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3756 py << trim EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3757 def test_keyboard_interrupt():
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3758 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3759 vim.command('while 1 | endwhile')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3760 except KeyboardInterrupt:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3761 cb.append('Caught KeyboardInterrupt')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3762 except Exception:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3763 cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info()))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3764 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3765 cb.append('!!!!!!!! No exception')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3766 try:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3767 vim.command('$ put =\'Running :put\'')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3768 except KeyboardInterrupt:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3769 cb.append('!!!!!!!! Caught KeyboardInterrupt')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3770 except Exception:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3771 cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info()))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3772 else:
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3773 cb.append('No exception')
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3774 EOF
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3775
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3776 debuggreedy
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3777 call inputsave()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3778 call feedkeys("s\ns\ns\ns\nq\n")
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3779 redir => output
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3780 debug silent! py test_keyboard_interrupt()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3781 redir END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3782 0 debuggreedy
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3783 call inputrestore()
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3784 py del test_keyboard_interrupt
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3785
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3786 let expected =<< trim END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3787 Caught KeyboardInterrupt
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3788 Running :put
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3789 No exception
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3790 END
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3791 call assert_equal(expected, getline(2, '$'))
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3792 call assert_equal('', output)
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3793 close!
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3794 endfunc
c2cbe6cc7620 patch 8.2.1120: Python code not tested properly
Bram Moolenaar <Bram@vim.org>
parents: 20233
diff changeset
3795
23264
f9526a3c9bbf patch 8.2.2178: Python 3: non-utf8 character cannot be handled
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
3796 func Test_python_non_utf8_string()
f9526a3c9bbf patch 8.2.2178: Python 3: non-utf8 character cannot be handled
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
3797 smap <Esc>@ <A-@>
f9526a3c9bbf patch 8.2.2178: Python 3: non-utf8 character cannot be handled
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
3798 python vim.command('redir => _tmp_smaps | smap | redir END')
f9526a3c9bbf patch 8.2.2178: Python 3: non-utf8 character cannot be handled
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
3799 python vim.eval('_tmp_smaps').splitlines()
f9526a3c9bbf patch 8.2.2178: Python 3: non-utf8 character cannot be handled
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
3800 sunmap <Esc>@
f9526a3c9bbf patch 8.2.2178: Python 3: non-utf8 character cannot be handled
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
3801 endfunc
f9526a3c9bbf patch 8.2.2178: Python 3: non-utf8 character cannot be handled
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
3802
20045
04ef2ccf2519 patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents: 18870
diff changeset
3803 " vim: shiftwidth=2 sts=2 expandtab