annotate src/testdir/test87.in @ 3695:002f2c5de317 v7.3.607

updated for version 7.3.607 Problem: With an 8 color terminal the selected menu item is black on black, because darkGrey as bg is the same as black. Solution: Swap fg and bg colors. (James McCoy)
author Bram Moolenaar <bram@vim.org>
date Thu, 19 Jul 2012 17:39:07 +0200
parents c052f3b79b99
children e75da4a3225d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3618
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 Tests for various python features. vim: set ft=vim :
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3 STARTTEST
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 :so small.vim
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5 :if !has('python3') | e! test.ok | wq! test.out | endif
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 :py3 import vim
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 :fun Test()
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 :let l = []
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 :py3 f=vim.bindeval('function("strlen")')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 :" Extending List directly with different types
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 :py3 l+=[1, "as'd", [1, 2, f, {'a': 1}]]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 :$put =string(l[-1])
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 :try
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 : $put =string(l[-4])
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 :catch
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 : $put =v:exception[:13]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 :endtry
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 :" List assignment
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 :py3 l[0]=0
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 :py3 l[-2]=f
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 :" Extending Dictionary directly with different types
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27 :let d = {}
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 :py3 d=vim.bindeval('d')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 :py3 d['1']='asd'
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 :py3 d['b']=[1, 2, f]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 :py3 d['-1']={'a': 1}
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 :let dkeys = []
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 :py3 dk=vim.bindeval('dkeys')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 :py3 dkeys=d.keys()
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 :py3 dkeys.sort()
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 :py3 dk+=dkeys
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 :$put =string(dkeys)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 :for [key, val] in sort(items(d))
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 : $put =string(key) . ' : ' . string(val)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 : unlet key val
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 :endfor
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 :" removing items with del
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44 :py3 del l[2]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46 :let l = range(8)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 :try
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 : py3 del l[:3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50 : py3 del l[1:]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 :catch
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 : $put =v:exception
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 :endtry
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56 :py3 del d['-1']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 :$put =string(d)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 :" removing items out of range: silently skip items that don't exist
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
62 :" The following two ranges delete nothing as they match empty list:
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 :py3 del l[2:1]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
64 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65 :py3 del l[2:2]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67 :py3 del l[2:3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
68 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
70 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 :py3 del l[2:4]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
74 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 :py3 del l[2:5]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 :py3 del l[2:6]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 :" The following two ranges delete nothing as they match empty list:
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 :py3 del l[-1:2]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86 :py3 del l[-2:2]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
87 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88 :py3 del l[-3:2]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
89 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92 :py3 del l[-4:2]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
95 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96 :py3 del l[-5:2]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
97 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
98 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
99 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
100 :py3 del l[-6:2]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
101 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
103 :" Slice assignment to a list
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
104 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
105 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
106 :py3 l[0:0]=['a']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
107 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
108 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
109 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
110 :py3 l[1:2]=['b']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
111 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
112 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
113 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
114 :py3 l[2:4]=['c']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
115 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
116 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
117 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
118 :py3 l[4:4]=['d']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
119 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
120 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
121 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
122 :py3 l[-1:2]=['e']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
123 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
124 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
125 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
126 :py3 l[-10:2]=['f']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
127 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
128 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
129 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
130 :py3 l[2:-10]=['g']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
131 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
132 :let l = []
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
133 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
134 :py3 l[0:0]=['h']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
135 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
136 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
137 :" Locked variables
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
138 :let l = [0, 1, 2, 3]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
139 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
140 :lockvar! l
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
141 :py3 l[2]='i'
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
142 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
143 :unlockvar! l
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
144 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
145 :" Function calls
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
146 :function New(...)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
147 :return ['NewStart']+a:000+['NewEnd']
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
148 :endfunction
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
149 :function DictNew(...) dict
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
150 :return ['DictNewStart']+a:000+['DictNewEnd', self]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
151 :endfunction
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
152 :let l=[function('New'), function('DictNew')]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
153 :py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
154 :py3 l.extend(list(l[0](1, 2, 3)))
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
155 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
156 :py3 l.extend(list(l[1](1, 2, 3, self={'a': 'b'})))
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
157 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
158 :py3 l+=[l[0].name]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
159 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
160 :try
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
161 : py3 l[1](1, 2, 3)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
162 :catch
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
163 : $put =v:exception[:13]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
164 :endtry
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
165 :delfunction New
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
166 :try
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
167 : py3 l[0](1, 2, 3)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
168 :catch
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
169 : $put =v:exception[:13]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
170 :endtry
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
171 :if has('float')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
172 : let l=[0.0]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
173 : py3 l=vim.bindeval('l')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
174 : py3 l.extend([0.0])
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
175 : $put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
176 :else
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
177 : $put ='[0.0, 0.0]'
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
178 :endif
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
179 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
180 :" py3eval()
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
181 :let l=py3eval('[0, 1, 2]')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
182 :$put =string(l)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
183 :let d=py3eval('{"a": "b", "c": 1, "d": ["e"]}')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
184 :$put =sort(items(d))
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
185 :try
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
186 : let undef=py3eval('undefined_name')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
187 :catch
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
188 : $put =v:exception[:13]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
189 :endtry
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
190 :try
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
191 : let vim=py3eval('vim')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
192 :catch
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
193 : $put =v:exception[:13]
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
194 :endtry
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
195 :if has('float')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
196 : let f=py3eval('0.0')
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
197 : $put =string(f)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
198 :else
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
199 : $put ='0.0'
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
200 :endif
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
201 :endfun
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
202 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
203 :call Test()
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
204 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
205 :delfunc Test
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
206 :call garbagecollect(1)
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
207 :"
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
208 :/^start:/,$wq! test.out
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
209 ENDTEST
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
210
c052f3b79b99 updated for version 7.3.569
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
211 start: