Mercurial > vim
annotate src/testdir/test_python3.vim @ 22806:690b84a6a7ce v8.2.1951
patch 8.2.1951: test for list and dict fails
Commit: https://github.com/vim/vim/commit/64ffa9b5fb34adb0b20fc22e8127604274bc3010
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 4 12:23:06 2020 +0100
patch 8.2.1951: test for list and dict fails
Problem: Test for list and dict fails.
Solution: Adjust for using an empty list/dict for a null one.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 04 Nov 2020 12:30:03 +0100 |
parents | 1928f863ac6e |
children | b545334ae654 |
rev | line source |
---|---|
14395
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
10751
diff
changeset
|
1 " Test for python 3 commands. |
10751
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 python3 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
5 source shared.vim |
10751
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
21977
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
7 func Create_vim_list() |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
8 return [1] |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
9 endfunction |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
10 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
11 func Create_vim_dict() |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
12 return {'a': 1} |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
13 endfunction |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
14 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
15 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
16 " This function should be called first. This sets up python functions used by |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
17 " the other tests. |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
18 func Test_AAA_python3_setup() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
19 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
20 import vim |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
21 import sys |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
22 import re |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
23 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
24 py33_type_error_pattern = re.compile('^__call__\(\) takes (\d+) positional argument but (\d+) were given$') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
25 py37_exception_repr = re.compile(r'([^\(\),])(\)+)$') |
22728
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
26 py39_type_error_pattern = re.compile('\w+\.([^(]+\(\) takes)') |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
27 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
28 def emsg(ei): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
29 return ei[0].__name__ + ':' + repr(ei[1].args) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
30 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
31 def ee(expr, g=globals(), l=locals()): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
32 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
33 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
34 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
35 exec(expr, g, l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
36 except Exception as e: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
37 if sys.version_info >= (3, 3) and e.__class__ is AttributeError and str(e).find('has no attribute')>=0 and not str(e).startswith("'vim."): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
38 msg = repr((e.__class__, AttributeError(str(e)[str(e).rfind(" '") + 2:-1]))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
39 elif sys.version_info >= (3, 3) and e.__class__ is ImportError and str(e).find('No module named \'') >= 0: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
40 msg = repr((e.__class__, ImportError(str(e).replace("'", '')))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
41 elif sys.version_info >= (3, 6) and e.__class__ is ModuleNotFoundError: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
42 # Python 3.6 gives ModuleNotFoundError, change it to an ImportError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
43 msg = repr((ImportError, ImportError(str(e).replace("'", '')))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
44 elif sys.version_info >= (3, 3) and e.__class__ is TypeError: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
45 m = py33_type_error_pattern.search(str(e)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
46 if m: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
47 msg = '__call__() takes exactly {0} positional argument ({1} given)'.format(m.group(1), m.group(2)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
48 msg = repr((e.__class__, TypeError(msg))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
49 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
50 msg = repr((e.__class__, e)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
51 # Messages changed with Python 3.6, change new to old. |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
52 newmsg1 = """'argument must be str, bytes or bytearray, not None'""" |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
53 oldmsg1 = '''"Can't convert 'NoneType' object to str implicitly"''' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
54 if msg.find(newmsg1) > -1: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
55 msg = msg.replace(newmsg1, oldmsg1) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
56 newmsg2 = """'argument must be str, bytes or bytearray, not int'""" |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
57 oldmsg2 = '''"Can't convert 'int' object to str implicitly"''' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
58 if msg.find(newmsg2) > -1: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
59 msg = msg.replace(newmsg2, oldmsg2) |
22728
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
60 # Python 3.9 reports errors like "vim.command() takes ..." instead of "command() takes ..." |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
61 msg = py39_type_error_pattern.sub(r'\1', msg) |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
62 elif sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte': |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
63 msg = repr((TypeError, TypeError('expected bytes with no null'))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
64 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
65 msg = repr((e.__class__, e)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
66 # Some Python versions say can't, others cannot. |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
67 if msg.find('can\'t') > -1: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
68 msg = msg.replace('can\'t', 'cannot') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
69 # Some Python versions use single quote, some double quote |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
70 if msg.find('"cannot ') > -1: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
71 msg = msg.replace('"cannot ', '\'cannot ') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
72 if msg.find(' attributes"') > -1: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
73 msg = msg.replace(' attributes"', ' attributes\'') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
74 if sys.version_info >= (3, 7): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
75 msg = py37_exception_repr.sub(r'\1,\2', msg) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
76 cb.append(expr + ':' + msg) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
77 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
78 cb.append(expr + ':NOT FAILED') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
79 except Exception as e: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
80 msg = repr((e.__class__, e)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
81 if sys.version_info >= (3, 7): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
82 msg = py37_exception_repr.sub(r'\1,\2', msg) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
83 cb.append(expr + '::' + msg) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
84 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
85 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
86 |
10751
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 func Test_py3do() |
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 " Check deleting lines does not trigger an ml_get error. |
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 new |
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 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
|
91 py3do vim.command("%d_") |
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 bwipe! |
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 |
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 " Check switching to another buffer does not trigger an ml_get error. |
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 new |
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 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
|
97 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
|
98 py3do 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
|
99 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
|
100 bwipe! |
27b42717662b
patch 8.0.0265: may get ml_get error when :pydo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 bwipe! |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
102 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
103 " 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
|
104 set nomodifiable |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21200
diff
changeset
|
105 call assert_fails('py3do toupper(line)', 'E21:') |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
106 set modifiable |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
107 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
108 " Invalid command |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
109 call AssertException(['py3do non_existing_cmd'], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
110 \ "Vim(py3do):NameError: 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
|
111 call AssertException(["py3do raise Exception('test')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
112 \ 'Vim(py3do):Exception: test') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
113 call AssertException(["py3do {lambda}"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
114 \ 'Vim(py3do):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
|
115 endfunc |
14395
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
10751
diff
changeset
|
116 |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
10751
diff
changeset
|
117 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
|
118 " 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
|
119 new |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
10751
diff
changeset
|
120 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
|
121 normal gg |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
10751
diff
changeset
|
122 py3do 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
|
123 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
|
124 |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
10751
diff
changeset
|
125 " 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
|
126 normal j |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
10751
diff
changeset
|
127 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
|
128 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
|
129 |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
130 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
|
131 " 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
|
132 |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
133 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
|
134 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
|
135 endfunc |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
136 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
|
137 |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
138 try |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
139 py3 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
|
140 call assert_equal(name, py3eval('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
|
141 catch |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
142 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
|
143 endtry |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
144 |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
145 try |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
146 py3 f = vim.Function(b'\x80\xfdR' + vim.eval('s:foo()').encode()) |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
147 call assert_equal(name, 'f.name'->py3eval()) |
15234
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
148 catch |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
149 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
|
150 endtry |
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
151 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
152 " Non-existing function attribute |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
153 call AssertException(["let x = py3eval('f.abc')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
154 \ "Vim(let):AttributeError: 'vim.function' object has no attribute 'abc'") |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
155 |
15234
ee63f4fe3d45
patch 8.1.0627: Python cannot handle function name of script-local function
Bram Moolenaar <Bram@vim.org>
parents:
14395
diff
changeset
|
156 py3 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
|
157 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
|
158 endfunc |
15888
a83c4b1f8ea2
patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents:
15234
diff
changeset
|
159 |
a83c4b1f8ea2
patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents:
15234
diff
changeset
|
160 func Test_skipped_python3_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
|
161 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
|
162 if 0 |
a83c4b1f8ea2
patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents:
15234
diff
changeset
|
163 python3 import vim |
a83c4b1f8ea2
patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents:
15234
diff
changeset
|
164 endif |
a83c4b1f8ea2
patch 8.1.0950: using :python sets 'pyxversion' even when not executed
Bram Moolenaar <Bram@vim.org>
parents:
15234
diff
changeset
|
165 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
|
166 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
|
167 |
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 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
|
169 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
|
170 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
|
171 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
|
172 |
bf8cf5c3b784
patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
15888
diff
changeset
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 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
|
180 |
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 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
|
182 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
|
183 |
16138
402b714cb919
patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
16080
diff
changeset
|
184 func _CleanUpHiddenBuffer() |
402b714cb919
patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
16080
diff
changeset
|
185 bwipe! hidden |
402b714cb919
patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
16080
diff
changeset
|
186 bwipe! |
402b714cb919
patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
16080
diff
changeset
|
187 endfunc |
402b714cb919
patch 8.1.1074: Python test doesn't wipe out hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
16080
diff
changeset
|
188 |
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
|
189 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
|
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 py3 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
|
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_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
|
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 py3 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
|
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 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
|
204 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
|
205 py3 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
|
206 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
|
207 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
|
208 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
|
209 |
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 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
|
211 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
|
212 py3 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
|
213 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
|
214 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
|
215 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
|
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 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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 |
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 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
|
229 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
|
230 |
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 py3 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
|
232 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
|
233 |
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 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
|
235 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
|
236 |
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 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
|
238 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
|
239 |
bf8cf5c3b784
patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
15888
diff
changeset
|
240 py3 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
|
241 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
|
242 |
bf8cf5c3b784
patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
15888
diff
changeset
|
243 bwipe! |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
244 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
|
245 |
bf8cf5c3b784
patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
15888
diff
changeset
|
246 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
|
247 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
|
248 |
bf8cf5c3b784
patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
15888
diff
changeset
|
249 py3 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
|
250 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
|
251 |
bf8cf5c3b784
patch 8.1.1045: E315 ml_get error when using Python and hidden buffer
Bram Moolenaar <Bram@vim.org>
parents:
15888
diff
changeset
|
252 bwipe! |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
253 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
|
254 |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
16138
diff
changeset
|
255 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
|
256 try |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
16138
diff
changeset
|
257 py3 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
|
258 catch /.*/ |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
16138
diff
changeset
|
259 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
|
260 endtry |
e791f29affae
patch 8.1.1346: error for Python exception does not show useful info
Bram Moolenaar <Bram@vim.org>
parents:
16138
diff
changeset
|
261 endfunc |
19015
a3d9a5e14c1f
patch 8.2.0068: crash when using Python 3 with "utf32" encoding
Bram Moolenaar <Bram@vim.org>
parents:
18870
diff
changeset
|
262 |
a3d9a5e14c1f
patch 8.2.0068: crash when using Python 3 with "utf32" encoding
Bram Moolenaar <Bram@vim.org>
parents:
18870
diff
changeset
|
263 func Test_unicode() |
a3d9a5e14c1f
patch 8.2.0068: crash when using Python 3 with "utf32" encoding
Bram Moolenaar <Bram@vim.org>
parents:
18870
diff
changeset
|
264 " this crashed Vim once |
19029
8aa4ba1f9345
patch 8.2.0075: Python 3 unicode test still sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
19027
diff
changeset
|
265 if &tenc != '' |
8aa4ba1f9345
patch 8.2.0075: Python 3 unicode test still sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
19027
diff
changeset
|
266 throw "Skipped: 'termencoding' is not empty" |
8aa4ba1f9345
patch 8.2.0075: Python 3 unicode test still sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
19027
diff
changeset
|
267 endif |
19027
d72b30bf3a80
patch 8.2.0074: Python 3 unicode test someitmes fails
Bram Moolenaar <Bram@vim.org>
parents:
19019
diff
changeset
|
268 |
19015
a3d9a5e14c1f
patch 8.2.0068: crash when using Python 3 with "utf32" encoding
Bram Moolenaar <Bram@vim.org>
parents:
18870
diff
changeset
|
269 set encoding=utf32 |
a3d9a5e14c1f
patch 8.2.0068: crash when using Python 3 with "utf32" encoding
Bram Moolenaar <Bram@vim.org>
parents:
18870
diff
changeset
|
270 py3 print('hello') |
19027
d72b30bf3a80
patch 8.2.0074: Python 3 unicode test someitmes fails
Bram Moolenaar <Bram@vim.org>
parents:
19019
diff
changeset
|
271 |
19031
9cad3d0c34b3
patch 8.2.0076: Python 3 unicode test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19029
diff
changeset
|
272 if !has('win32') |
9cad3d0c34b3
patch 8.2.0076: Python 3 unicode test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19029
diff
changeset
|
273 set encoding=debug |
9cad3d0c34b3
patch 8.2.0076: Python 3 unicode test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19029
diff
changeset
|
274 py3 print('hello') |
19037
9bb2a4f6296a
patch 8.2.0079: Python 3 unicode test still fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19031
diff
changeset
|
275 |
9bb2a4f6296a
patch 8.2.0079: Python 3 unicode test still fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19031
diff
changeset
|
276 set encoding=euc-tw |
9bb2a4f6296a
patch 8.2.0079: Python 3 unicode test still fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19031
diff
changeset
|
277 py3 print('hello') |
19031
9cad3d0c34b3
patch 8.2.0076: Python 3 unicode test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19029
diff
changeset
|
278 endif |
19027
d72b30bf3a80
patch 8.2.0074: Python 3 unicode test someitmes fails
Bram Moolenaar <Bram@vim.org>
parents:
19019
diff
changeset
|
279 |
19015
a3d9a5e14c1f
patch 8.2.0068: crash when using Python 3 with "utf32" encoding
Bram Moolenaar <Bram@vim.org>
parents:
18870
diff
changeset
|
280 set encoding=utf8 |
a3d9a5e14c1f
patch 8.2.0068: crash when using Python 3 with "utf32" encoding
Bram Moolenaar <Bram@vim.org>
parents:
18870
diff
changeset
|
281 endfunc |
19141
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
282 |
19499
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
283 " Test vim.eval() with various types. |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
284 func Test_python3_vim_val() |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
285 call assert_equal("\n8", execute('py3 print(vim.eval("3+5"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
286 if has('float') |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
287 call assert_equal("\n3.140000", execute('py3 print(vim.eval("1.01+2.13"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
288 call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
289 call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
290 call assert_equal("\n-0.000000", execute('py3 print(vim.eval("0.0/(-1.0/0.0)"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
291 " Commented out: output of infinity and nan depend on platforms. |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
292 " call assert_equal("\ninf", execute('py3 print(vim.eval("1.0/0.0"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
293 " call assert_equal("\n-inf", execute('py3 print(vim.eval("-1.0/0.0"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
294 " call assert_equal("\n-nan", execute('py3 print(vim.eval("0.0/0.0"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
295 endif |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
296 call assert_equal("\nabc", execute('py3 print(vim.eval("\"abc\""))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
297 call assert_equal("\n['1', '2']", execute('py3 print(vim.eval("[1, 2]"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
298 call assert_equal("\n{'1': '2'}", execute('py3 print(vim.eval("{1:2}"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
299 call assert_equal("\nTrue", execute('py3 print(vim.eval("v:true"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
300 call assert_equal("\nFalse", execute('py3 print(vim.eval("v:false"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
301 call assert_equal("\nNone", execute('py3 print(vim.eval("v:null"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
302 call assert_equal("\nNone", execute('py3 print(vim.eval("v:none"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
303 call assert_equal("\nb'\\xab\\x12'", execute('py3 print(vim.eval("0zab12"))')) |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
304 |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21200
diff
changeset
|
305 call assert_fails('py3 vim.eval("1+")', 'E15: Invalid expression') |
19499
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
306 endfunc |
f22626353eb3
patch 8.2.0307: Python 3 vim.eval not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
307 |
19141
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
308 " Test range objects, see :help python-range |
19201
e7b4fff348dd
patch 8.2.0159: non-materialized range() list causes problems
Bram Moolenaar <Bram@vim.org>
parents:
19141
diff
changeset
|
309 func Test_python3_range() |
19141
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
310 new |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
311 py3 b = vim.current.buffer |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
312 |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
313 call setline(1, range(1, 6)) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
314 py3 r = b.range(2, 4) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
315 call assert_equal(6, py3eval('len(b)')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
316 call assert_equal(3, py3eval('len(r)')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
317 call assert_equal('3', py3eval('b[2]')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
318 call assert_equal('4', py3eval('r[2]')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
319 |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21200
diff
changeset
|
320 call assert_fails('py3 r[3] = "x"', ['Traceback', 'IndexError: line number out of range']) |
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21200
diff
changeset
|
321 call assert_fails('py3 x = r[3]', ['Traceback', 'IndexError: line number out of range']) |
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21200
diff
changeset
|
322 call assert_fails('py3 r["a"] = "x"', ['Traceback', 'TypeError: index must be int or slice, not str']) |
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21200
diff
changeset
|
323 call assert_fails('py3 x = r["a"]', ['Traceback', 'TypeError: index must be int or slice, not str']) |
19141
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
324 |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
325 py3 del r[:] |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
326 call assert_equal(['1', '5', '6'], getline(1, '$')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
327 |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
328 %d | call setline(1, range(1, 6)) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
329 py3 r = b.range(2, 5) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
330 py3 del r[2] |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
331 call assert_equal(['1', '2', '3', '5', '6'], getline(1, '$')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
332 |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
333 %d | call setline(1, range(1, 6)) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
334 py3 r = b.range(2, 4) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
335 py3 vim.command("%d,%dnorm Ax" % (r.start + 1, r.end + 1)) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
336 call assert_equal(['1', '2x', '3x', '4x', '5', '6'], getline(1, '$')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
337 |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
338 %d | call setline(1, range(1, 4)) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
339 py3 r = b.range(2, 3) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
340 py3 r.append(['a', 'b']) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
341 call assert_equal(['1', '2', '3', 'a', 'b', '4'], getline(1, '$')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
342 py3 r.append(['c', 'd'], 0) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
343 call assert_equal(['1', 'c', 'd', '2', '3', 'a', 'b', '4'], getline(1, '$')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
344 |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
345 %d | call setline(1, range(1, 5)) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
346 py3 r = b.range(2, 4) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
347 py3 r.append('a') |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
348 call assert_equal(['1', '2', '3', '4', 'a', '5'], getline(1, '$')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
349 py3 r.append('b', 1) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
350 call assert_equal(['1', '2', 'b', '3', '4', 'a', '5'], getline(1, '$')) |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
351 |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
352 bwipe! |
2c7d60b1bfa9
patch 8.2.0130: Python3 ranges are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19037
diff
changeset
|
353 endfunc |
19991
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
354 |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
355 " Test for resetting options with local values to global values |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
356 func Test_python3_opt_reset_local_to_global() |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
357 new |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
358 |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
359 py3 curbuf = vim.current.buffer |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
360 py3 curwin = vim.current.window |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
361 |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
362 " List of buffer-local options. Each list item has [option name, global |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
363 " value, buffer-local value, buffer-local value after reset] to use in the |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
364 " test. |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
365 let bopts = [ |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
366 \ ['autoread', 1, 0, -1], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
367 \ ['equalprg', 'geprg', 'leprg', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
368 \ ['keywordprg', 'gkprg', 'lkprg', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
369 \ ['path', 'gpath', 'lpath', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
370 \ ['backupcopy', 'yes', 'no', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
371 \ ['tags', 'gtags', 'ltags', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
372 \ ['tagcase', 'ignore', 'match', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
373 \ ['define', 'gdef', 'ldef', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
374 \ ['include', 'ginc', 'linc', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
375 \ ['dict', 'gdict', 'ldict', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
376 \ ['thesaurus', 'gtsr', 'ltsr', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
377 \ ['formatprg', 'gfprg', 'lfprg', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
378 \ ['errorformat', '%f:%l:%m', '%s-%l-%m', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
379 \ ['grepprg', 'ggprg', 'lgprg', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
380 \ ['makeprg', 'gmprg', 'lmprg', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
381 \ ['balloonexpr', 'gbexpr', 'lbexpr', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
382 \ ['cryptmethod', 'blowfish2', 'zip', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
383 \ ['lispwords', 'abc', 'xyz', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
384 \ ['makeencoding', 'utf-8', 'latin1', ''], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
385 \ ['undolevels', 100, 200, -123456]] |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
386 |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
387 " Set the global and buffer-local option values and then clear the |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
388 " buffer-local option value. |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
389 for opt in bopts |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
390 py3 << trim END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
391 pyopt = vim.bindeval("opt") |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
392 vim.options[pyopt[0]] = pyopt[1] |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
393 curbuf.options[pyopt[0]] = pyopt[2] |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
394 END |
19991
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
395 exe "call assert_equal(opt[2], &" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
396 exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
397 exe "call assert_equal(opt[2], &l:" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
398 py3 del curbuf.options[pyopt[0]] |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
399 exe "call assert_equal(opt[1], &" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
400 exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
401 exe "call assert_equal(opt[3], &l:" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
402 exe "set " .. opt[0] .. "&" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
403 endfor |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
404 |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
405 " Set the global and window-local option values and then clear the |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
406 " window-local option value. |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
407 let wopts = [ |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
408 \ ['scrolloff', 5, 10, -1], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
409 \ ['sidescrolloff', 6, 12, -1], |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
410 \ ['statusline', '%<%f', '%<%F', '']] |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
411 for opt in wopts |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
412 py3 << trim |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
413 pyopt = vim.bindeval("opt") |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
414 vim.options[pyopt[0]] = pyopt[1] |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
415 curwin.options[pyopt[0]] = pyopt[2] |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
416 . |
19991
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
417 exe "call assert_equal(opt[2], &" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
418 exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
419 exe "call assert_equal(opt[2], &l:" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
420 py3 del curwin.options[pyopt[0]] |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
421 exe "call assert_equal(opt[1], &" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
422 exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
423 exe "call assert_equal(opt[3], &l:" .. opt[0] .. ")" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
424 exe "set " .. opt[0] .. "&" |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
425 endfor |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
426 |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
427 close! |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
428 endfunc |
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
429 |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
430 " Test for various heredoc syntax |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
431 func Test_python3_heredoc() |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
432 python3 << END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
433 s='A' |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
434 END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
435 python3 << |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
436 s+='B' |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
437 . |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
438 python3 << trim END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
439 s+='C' |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
440 END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
441 python3 << trim |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
442 s+='D' |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
443 . |
20233
5f9c2c7d3d73
patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
444 python3 << 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
|
445 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
|
446 eof |
5f9c2c7d3d73
patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
447 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:
19991
diff
changeset
|
448 endfunc |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19991
diff
changeset
|
449 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
450 " Test for the buffer range object |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
451 func Test_python3_range2() |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
452 new |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
453 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
|
454 py3 b = vim.current.buffer |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
455 py3 r = b.range(1, 3) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
456 call assert_equal(0, py3eval('r.start')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
457 call assert_equal(2, py3eval('r.end')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
458 call assert_equal('one', py3eval('r[0]')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
459 call assert_equal('one', py3eval('r[-3]')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
460 call AssertException(["let x = py3eval('r[-4]')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
461 \ 'Vim(let):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
|
462 call assert_equal(['two', 'three'], py3eval('r[1:]')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
463 py3 r[0] = 'green' |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
464 call assert_equal(['green', 'two', 'three'], getline(1, '$')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
465 py3 r[0:2] = ['red', 'blue'] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
466 call assert_equal(['red', 'blue', 'three'], getline(1, '$')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
467 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
468 " 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
|
469 %d |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
470 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
|
471 py3 r[-10:1] = ["a"] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
472 py3 r[10:12] = ["b"] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
473 py3 r[-10:-9] = ["c"] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
474 py3 r[1:0] = ["d"] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
475 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
|
476 |
21198
8531ddd7dd63
patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents:
21190
diff
changeset
|
477 " 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
|
478 %d |
8531ddd7dd63
patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents:
21190
diff
changeset
|
479 let x = py3eval('r[:]') |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
480 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
481 " Non-existing range attribute |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
482 call AssertException(["let x = py3eval('r.abc')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
483 \ "Vim(let):AttributeError: 'vim.range' object has no attribute 'abc'") |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
484 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
485 close! |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
486 endfunc |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
487 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
488 " Test for the python tabpage object |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
489 func Test_python3_tabpage() |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
490 tabnew |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
491 py3 t = vim.tabpages[1] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
492 py3 wl = t.windows |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
493 tabclose |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
494 " Accessing a closed tabpage |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
495 call AssertException(["let n = py3eval('t.number')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
496 \ '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
|
497 call AssertException(["let n = py3eval('len(wl)')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
498 \ '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
|
499 call AssertException(["py3 w = wl[0]"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
500 \ 'Vim(py3):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
|
501 call AssertException(["py3 vim.current.tabpage = t"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
502 \ 'Vim(py3):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
|
503 call assert_match('<tabpage object (deleted)', py3eval('repr(t)')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
504 %bw! |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
505 endfunc |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
506 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
507 " Test for the python window object |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
508 func Test_python3_window() |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
509 " 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
|
510 10new |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
511 py3 vim.current.window.height = 5 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
512 call assert_equal(5, winheight(0)) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
513 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
514 " 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
|
515 10vnew |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
516 py3 vim.current.window.width = 6 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
517 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
|
518 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
519 " Try accessing a closed window |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
520 py3 w = vim.current.window |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
521 py3 wopts = w.options |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
522 close |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
523 " 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
|
524 call AssertException(["let n = py3eval('w.number')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
525 \ '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
|
526 call AssertException(["py3 w.height = 5"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
527 \ 'Vim(py3):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
|
528 call AssertException(["py3 vim.current.window = w"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
529 \ 'Vim(py3):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
|
530 " 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
|
531 " The following caused ASAN failure |
8531ddd7dd63
patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents:
21190
diff
changeset
|
532 call AssertException(["py3 wopts['list'] = False"], |
8531ddd7dd63
patch 8.2.1150: ml_get error when using Python
Bram Moolenaar <Bram@vim.org>
parents:
21190
diff
changeset
|
533 \ 'Vim(py3):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
|
534 call assert_match('<window object (deleted)', py3eval("repr(w)")) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
535 %bw! |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
536 endfunc |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
537 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
538 " Test for the python List object |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
539 func Test_python3_list() |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
540 " 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
|
541 call AssertException(["py3 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
|
542 \ 'Vim(py3):SystemError: <built-in function eval> returned NULL without setting an error') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
543 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
544 " 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
|
545 call AssertException(["py3 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
|
546 \ 'Vim(py3):SystemError: <built-in function eval> returned NULL without setting an error') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
547 |
22806
690b84a6a7ce
patch 8.2.1951: test for list and dict fails
Bram Moolenaar <Bram@vim.org>
parents:
22728
diff
changeset
|
548 " 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
|
549 let cmds =<< trim END |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
550 let l = test_null_list() |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
551 py3 ll = vim.bindeval('l') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
552 END |
22806
690b84a6a7ce
patch 8.2.1951: test for list and dict fails
Bram Moolenaar <Bram@vim.org>
parents:
22728
diff
changeset
|
553 call AssertException(cmds, '') |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
554 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
555 let l = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
556 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
557 py3 f = vim.bindeval('function("strlen")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
558 " Extending List directly with different types |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
559 py3 l += [1, "as'd", [1, 2, f, {'a': 1}]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
560 call assert_equal([1, "as'd", [1, 2, function("strlen"), {'a': 1}]], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
561 call assert_equal([1, 2, function("strlen"), {'a': 1}], l[-1]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
562 call assert_fails('echo l[-4]', 'E684:') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
563 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
564 " List assignment |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
565 py3 l[0] = 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
566 call assert_equal([0, "as'd", [1, 2, function("strlen"), {'a': 1}]], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
567 py3 l[-2] = f |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
568 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
|
569 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
570 " appending to a list |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
571 let l = [1, 2] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
572 py3 ll = vim.bindeval('l') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
573 py3 ll[2] = 8 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
574 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
|
575 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
576 " Using dict as an index |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
577 call AssertException(['py3 ll[{}] = 10'], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
578 \ 'Vim(py3):TypeError: index must be int or slice, not dict') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
579 endfunc |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
580 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
581 " Test for the python Dict object |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
582 func Test_python3_dict() |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
583 " 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
|
584 call AssertException(["py3 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
|
585 \ 'Vim(py3):SystemError: <built-in function eval> returned NULL without setting an error') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
586 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
587 " 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
|
588 call AssertException(["py3 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
|
589 \ 'Vim(py3):SystemError: <built-in function eval> returned NULL without setting an error') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
590 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
591 " 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
|
592 py3 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
|
593 call assert_fails("let d = py3eval('t')", 'E859:') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
594 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
595 " Dict length |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
596 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
|
597 py3 d = vim.bindeval('d') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
598 call assert_equal(2, py3eval('len(d)')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
599 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
600 " Deleting an non-existing key |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
601 call AssertException(["py3 del d['c']"], "Vim(py3):KeyError: 'c'") |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
602 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
603 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
604 " Extending Dictionary directly with different types |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
605 func Test_python3_dict_extend() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
606 let d = {} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
607 func d.f() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
608 return 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
609 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
610 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
611 py3 f = vim.bindeval('function("strlen")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
612 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
613 d = vim.bindeval('d') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
614 d['1'] = 'asd' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
615 d.update() # Must not do anything, including throwing errors |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
616 d.update(b = [1, 2, f]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
617 d.update((('-1', {'a': 1}),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
618 d.update({'0': -1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
619 dk = d.keys() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
620 dv = d.values() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
621 di = d.items() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
622 dk.sort(key=repr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
623 dv.sort(key=repr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
624 di.sort(key=repr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
625 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
626 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
627 " Try extending a locked dictionary |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
628 lockvar d |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
629 call AssertException(["py3 d.update({'b' : 20})"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
630 \ 'Vim(py3):vim.error: dictionary is locked') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
631 unlockvar d |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
632 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
633 call assert_equal(1, py3eval("d['f'](self={})")) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
634 call assert_equal("[b'-1', b'0', b'1', b'b', b'f']", py3eval('repr(dk)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
635 call assert_equal("[-1, <vim.Function '1'>, <vim.dictionary object at >, <vim.list object at >, b'asd']", substitute(py3eval('repr(dv)'),'0x\x\+','','g')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
636 call assert_equal("[(b'-1', <vim.dictionary object at >), (b'0', -1), (b'1', b'asd'), (b'b', <vim.list object at >), (b'f', <vim.Function '1'>)]", substitute(py3eval('repr(di)'),'0x\x\+','','g')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
637 call assert_equal(['0', '1', 'b', 'f', '-1'], keys(d)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
638 call assert_equal("[-1, 'asd', [1, 2, function('strlen')], function('1'), {'a': 1}]", string(values(d))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
639 py3 del dk |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
640 py3 del di |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
641 py3 del dv |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
642 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
643 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
644 func Test_python3_list_del_items() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
645 " removing items with del |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
646 let l = [0, function("strlen"), [1, 2, function("strlen"), {'a': 1}]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
647 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
648 py3 del l[2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
649 call assert_equal("[0, function('strlen')]", string(l)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
650 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
651 let l = range(8) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
652 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
653 py3 del l[:3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
654 py3 del l[1:] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
655 call assert_equal([3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
656 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
657 " removing items out of range: silently skip items that don't exist |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
658 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
659 " The following two ranges delete nothing as they match empty list: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
660 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
661 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
662 py3 del l[2:1] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
663 call assert_equal([0, 1, 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
664 py3 del l[2:2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
665 call assert_equal([0, 1, 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
666 py3 del l[2:3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
667 call assert_equal([0, 1, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
668 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
669 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
670 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
671 py3 del l[2:4] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
672 call assert_equal([0, 1], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
673 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
674 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
675 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
676 py3 del l[2:5] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
677 call assert_equal([0, 1], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
678 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
679 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
680 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
681 py3 del l[2:6] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
682 call assert_equal([0, 1], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
683 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
684 " The following two ranges delete nothing as they match empty list: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
685 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
686 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
687 py3 del l[-1:2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
688 call assert_equal([0, 1, 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
689 py3 del l[-2:2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
690 call assert_equal([0, 1, 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
691 py3 del l[-3:2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
692 call assert_equal([0, 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
693 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
694 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
695 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
696 py3 del l[-4:2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
697 call assert_equal([2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
698 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
699 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
700 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
701 py3 del l[-5:2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
702 call assert_equal([2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
703 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
704 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
705 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
706 py3 del l[-6:2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
707 call assert_equal([2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
708 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
709 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
710 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
711 py3 del l[::2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
712 call assert_equal([1, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
713 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
714 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
715 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
716 py3 del l[3:0:-2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
717 call assert_equal([0, 2], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
718 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
719 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
720 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
721 py3 del l[2:4:-2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
722 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
723 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
724 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
725 func Test_python3_dict_del_items() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
726 let d = eval("{'0' : -1, '1' : 'asd', 'b' : [1, 2, function('strlen')], 'f' : function('min'), '-1' : {'a': 1}}") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
727 py3 d = vim.bindeval('d') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
728 py3 del d['-1'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
729 py3 del d['f'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
730 call assert_equal([1, 2, function('strlen')], py3eval('d.get(''b'', 1)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
731 call assert_equal([1, 2, function('strlen')], py3eval('d.pop(''b'')')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
732 call assert_equal(1, py3eval('d.get(''b'', 1)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
733 call assert_equal('asd', py3eval('d.pop(''1'', 2)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
734 call assert_equal(2, py3eval('d.pop(''1'', 2)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
735 call assert_equal('True', py3eval('repr(d.has_key(''0''))')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
736 call assert_equal('False', py3eval('repr(d.has_key(''1''))')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
737 call assert_equal('True', py3eval('repr(''0'' in d)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
738 call assert_equal('False', py3eval('repr(''1'' in d)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
739 call assert_equal("[b'0']", py3eval('repr(list(iter(d)))')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
740 call assert_equal({'0' : -1}, d) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
741 call assert_equal("(b'0', -1)", py3eval('repr(d.popitem())')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
742 call assert_equal('None', py3eval('repr(d.get(''0''))')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
743 call assert_equal('[]', py3eval('repr(list(iter(d)))')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
744 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
745 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
746 " Slice assignment to a list |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
747 func Test_python3_slice_assignment() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
748 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
749 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
750 py3 l[0:0] = ['a'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
751 call assert_equal(['a', 0, 1, 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
752 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
753 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
754 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
755 py3 l[1:2] = ['b'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
756 call assert_equal([0, 'b', 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
757 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
758 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
759 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
760 py3 l[2:4] = ['c'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
761 call assert_equal([0, 1, 'c'], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
762 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
763 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
764 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
765 py3 l[4:4] = ['d'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
766 call assert_equal([0, 1, 2, 3, 'd'], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
767 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
768 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
769 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
770 py3 l[-1:2] = ['e'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
771 call assert_equal([0, 1, 2, 'e', 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
772 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
773 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
774 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
775 py3 l[-10:2] = ['f'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
776 call assert_equal(['f', 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
777 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
778 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
779 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
780 py3 l[2:-10] = ['g'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
781 call assert_equal([0, 1, 'g', 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
782 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
783 let l = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
784 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
785 py3 l[0:0] = ['h'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
786 call assert_equal(['h'], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
787 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
788 let l = range(8) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
789 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
790 py3 l[2:6:2] = [10, 20] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
791 call assert_equal([0, 1, 10, 3, 20, 5, 6, 7], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
792 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
793 let l = range(8) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
794 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
795 py3 l[6:2:-2] = [10, 20] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
796 call assert_equal([0, 1, 2, 3, 20, 5, 10, 7], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
797 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
798 let l = range(8) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
799 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
800 py3 l[6:2] = () |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
801 call assert_equal([0, 1, 2, 3, 4, 5, 6, 7], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
802 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
803 let l = range(8) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
804 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
805 py3 l[6:2:1] = () |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
806 call assert_equal([0, 1, 2, 3, 4, 5, 6, 7], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
807 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
808 let l = range(8) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
809 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
810 py3 l[2:2:1] = () |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
811 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
|
812 |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
813 call AssertException(["py3 x = l[10:11:0]"], |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
814 \ "Vim(py3):ValueError: slice step cannot be zero") |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
815 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
816 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
817 " Locked variables |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
818 func Test_python3_lockedvar() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
819 new |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
820 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
821 let l = [0, 1, 2, 3] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
822 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
823 lockvar! l |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
824 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
825 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
826 l[2]='i' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
827 except vim.error: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
828 cb.append('l[2] threw vim.error: ' + emsg(sys.exc_info())) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
829 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
830 call assert_equal(['', "l[2] threw vim.error: error:('list is locked',)"], |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
831 \ getline(1, '$')) |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
832 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
833 " 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
|
834 call AssertException(['py3 l += [4, 5]'], 'Vim(py3):vim.error: list is locked') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
835 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
836 call assert_equal([0, 1, 2, 3], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
837 unlockvar! l |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
838 close! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
839 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
840 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
841 " Test for calling a function |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
842 func Test_python3_function_call() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
843 func New(...) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
844 return ['NewStart'] + a:000 + ['NewEnd'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
845 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
846 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
847 func DictNew(...) dict |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
848 return ['DictNewStart'] + a:000 + ['DictNewEnd', self] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
849 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
850 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
851 new |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
852 let l = [function('New'), function('DictNew')] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
853 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
854 py3 l.extend(list(l[0](1, 2, 3))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
855 call assert_equal([function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd'], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
856 py3 l.extend(list(l[1](1, 2, 3, self={'a': 'b'}))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
857 call assert_equal([function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
858 py3 l += [[l[0].name]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
859 call assert_equal([function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}, ['New']], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
860 py3 ee('l[1](1, 2, 3)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
861 call assert_equal("l[1](1, 2, 3):(<class 'vim.error'>, error('Vim:E725: Calling dict function without Dictionary: DictNew',))", getline(2)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
862 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
863 py3 f = l[0] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
864 delfunction New |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
865 py3 ee('f(1, 2, 3)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
866 call assert_equal("f(1, 2, 3):(<class 'vim.error'>, error('Vim:E117: Unknown function: New',))", getline(2)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
867 close! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
868 delfunction DictNew |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
869 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
870 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
871 func Test_python3_float() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
872 CheckFeature float |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
873 let l = [0.0] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
874 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
875 py3 l.extend([0.0]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
876 call assert_equal([0.0, 0.0], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
877 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
878 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
879 " Test for Dict key errors |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
880 func Test_python3_dict_key_error() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
881 let messages = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
882 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
883 import sys |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
884 d = vim.bindeval('{}') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
885 m = vim.bindeval('messages') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
886 def em(expr, g=globals(), l=locals()): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
887 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
888 exec(expr, g, l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
889 except Exception as e: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
890 if sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte': |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
891 m.extend([TypeError.__name__]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
892 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
893 m.extend([e.__class__.__name__]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
894 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
895 em('d["abc1"]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
896 em('d["abc1"]="\\0"') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
897 em('d["abc1"]=vim') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
898 em('d[""]=1') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
899 em('d["a\\0b"]=1') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
900 em('d[b"a\\0b"]=1') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
901 em('d.pop("abc1")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
902 em('d.popitem()') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
903 del em |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
904 del m |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
905 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
906 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
907 call assert_equal(['KeyError', 'TypeError', 'TypeError', 'ValueError', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
908 \ 'TypeError', 'TypeError', 'KeyError', 'KeyError'], messages) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
909 unlet messages |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
910 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
911 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
912 " Test for locked and scope attributes |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
913 func Test_python3_lock_scope_attr() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
914 let d = {} | let dl = {} | lockvar dl |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
915 let res = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
916 for s in split("d dl v: g:") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
917 let name = tr(s, ':', 's') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
918 execute 'py3 ' .. name .. ' = vim.bindeval("' .. s .. '")' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
919 call add(res, s .. ' : ' .. join(map(['locked', 'scope'], |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
920 \ 'v:val .. ":" .. py3eval(name .. "." .. v:val)'), ';')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
921 endfor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
922 call assert_equal(['d : locked:0;scope:0', 'dl : locked:1;scope:0', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
923 \ 'v: : locked:2;scope:1', 'g: : locked:0;scope:2'], res) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
924 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
925 silent! let d.abc2 = 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
926 silent! let dl.abc3 = 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
927 py3 d.locked = True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
928 py3 dl.locked = False |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
929 silent! let d.def = 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
930 silent! let dl.def = 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
931 call assert_equal({'abc2': 1}, d) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
932 call assert_equal({'def': 1}, dl) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
933 unlet d dl |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
934 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
935 let l = [] | let ll = [] | lockvar ll |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
936 let res = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
937 for s in split("l ll") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
938 let name = tr(s, ':', 's') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
939 execute 'py3 ' .. name .. '=vim.bindeval("' .. s .. '")' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
940 call add(res, s .. ' : locked:' .. py3eval(name .. '.locked')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
941 endfor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
942 call assert_equal(['l : locked:0', 'll : locked:1'], res) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
943 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
944 silent! call extend(l, [0]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
945 silent! call extend(ll, [0]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
946 py3 l.locked = True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
947 py3 ll.locked = False |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
948 silent! call extend(l, [1]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
949 silent! call extend(ll, [1]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
950 call assert_equal([0], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
951 call assert_equal([1], ll) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
952 unlet l ll |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
953 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
954 " 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
|
955 py3 a = vim.bindeval('v:argv') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
956 call AssertException(['py3 a.locked = 0'], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
957 \ 'Vim(py3):TypeError: cannot modify fixed list') |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
958 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
959 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
960 " Test for py3eval() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
961 func Test_python3_pyeval() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
962 let l = py3eval('[0, 1, 2]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
963 call assert_equal([0, 1, 2], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
964 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
965 let d = py3eval('{"a": "b", "c": 1, "d": ["e"]}') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
966 call assert_equal([['a', 'b'], ['c', 1], ['d', ['e']]], sort(items(d))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
967 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
968 let v:errmsg = '' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
969 call assert_equal(v:none, py3eval('None')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
970 call assert_equal('', v:errmsg) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
971 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
972 py3 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
|
973 call assert_equal(v:none, py3eval('v')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
974 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
975 if has('float') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
976 call assert_equal(0.0, py3eval('0.0')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
977 endif |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
978 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
979 " Evaluate an invalid values |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
980 call AssertException(['let v = py3eval(''"\0"'')'], 'E859:') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
981 call AssertException(['let v = py3eval(''{"\0" : 1}'')'], 'E859:') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
982 call AssertException(['let v = py3eval("undefined_name")'], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
983 \ "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
|
984 call AssertException(['let v = py3eval("vim")'], 'E859:') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
985 endfunc |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
986 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
987 " Test for vim.bindeval() |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
988 func Test_python3_vim_bindeval() |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
989 " Float |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
990 let f = 3.14 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
991 py3 f = vim.bindeval('f') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
992 call assert_equal(3.14, py3eval('f')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
993 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
994 " Blob |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
995 let b = 0z12 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
996 py3 b = vim.bindeval('b') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
997 call assert_equal("\x12", py3eval('b')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
998 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
999 " Bool |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1000 call assert_equal(1, py3eval("vim.bindeval('v:true')")) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1001 call assert_equal(0, py3eval("vim.bindeval('v:false')")) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1002 call assert_equal(v:none, py3eval("vim.bindeval('v:null')")) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1003 call assert_equal(v:none, py3eval("vim.bindeval('v:none')")) |
21200
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1004 |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1005 " channel/job |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1006 call assert_equal(v:none, py3eval("vim.bindeval('test_null_channel()')")) |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1007 call assert_equal(v:none, py3eval("vim.bindeval('test_null_job()')")) |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1008 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1009 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1010 " threading |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1011 " Running py3do command (Test_pydo) before this test, stops the python thread |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1012 " from running. So this test should be run before the pydo test |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1013 func Test_aaa_python3_threading() |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1014 let l = [0] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1015 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1016 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1017 import threading |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1018 import time |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1019 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1020 class T(threading.Thread): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1021 def __init__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1022 threading.Thread.__init__(self) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1023 self.t = 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1024 self.running = True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1025 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1026 def run(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1027 while self.running: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1028 self.t += 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1029 time.sleep(0.1) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1030 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1031 t = T() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1032 del T |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1033 t.start() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1034 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1035 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1036 sleep 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1037 py3 t.running = False |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1038 py3 t.join() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1039 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1040 " Check if the background thread is working. Count should be 10, but on a |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1041 " busy system (AppVeyor) it can be much lower. |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1042 py3 l[0] = t.t > 4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1043 py3 del time |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1044 py3 del threading |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1045 py3 del t |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1046 call assert_equal([1], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1047 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1048 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1049 " settrace |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1050 func Test_python3_settrace() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1051 let l = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1052 py3 l = vim.bindeval('l') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1053 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1054 import sys |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1055 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1056 def traceit(frame, event, arg): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1057 global l |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1058 if event == "line": |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1059 l += [frame.f_lineno] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1060 return traceit |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1061 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1062 def trace_main(): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1063 for i in range(5): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1064 pass |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1065 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1066 py3 sys.settrace(traceit) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1067 py3 trace_main() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1068 py3 sys.settrace(None) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1069 py3 del traceit |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1070 py3 del trace_main |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1071 call assert_equal([1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1], l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1072 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1073 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1074 " Slice |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1075 func Test_python3_list_slice() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1076 py3 ll = vim.bindeval('[0, 1, 2, 3, 4, 5]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1077 py3 l = ll[:4] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1078 call assert_equal([0, 1, 2, 3], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1079 py3 l = ll[2:] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1080 call assert_equal([2, 3, 4, 5], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1081 py3 l = ll[:-4] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1082 call assert_equal([0, 1], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1083 py3 l = ll[-2:] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1084 call assert_equal([4, 5], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1085 py3 l = ll[2:4] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1086 call assert_equal([2, 3], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1087 py3 l = ll[4:2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1088 call assert_equal([], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1089 py3 l = ll[-4:-2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1090 call assert_equal([2, 3], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1091 py3 l = ll[-2:-4] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1092 call assert_equal([], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1093 py3 l = ll[:] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1094 call assert_equal([0, 1, 2, 3, 4, 5], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1095 py3 l = ll[0:6] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1096 call assert_equal([0, 1, 2, 3, 4, 5], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1097 py3 l = ll[-10:10] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1098 call assert_equal([0, 1, 2, 3, 4, 5], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1099 py3 l = ll[4:2:-1] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1100 call assert_equal([4, 3], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1101 py3 l = ll[::2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1102 call assert_equal([0, 2, 4], py3eval('l')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1103 py3 l = ll[4:2:1] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1104 call assert_equal([], py3eval('l')) |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1105 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1106 " 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
|
1107 call AssertException(['py3 ll[-10] = 5'], 'Vim(py3):vim.error: internal error:') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1108 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1109 " 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
|
1110 call AssertException(['py3 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
|
1111 \ 'Vim(py3):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
|
1112 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1113 " Error case: Invalid slice type |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1114 call AssertException(["py3 x = ll['abc']"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1115 \ "Vim(py3):TypeError: index must be int or slice, not str") |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1116 py3 del l |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1117 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1118 " 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
|
1119 let l = [test_null_list()] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1120 py3 ll = vim.bindeval('l') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1121 call AssertException(["py3 x = ll[:]"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1122 \ "Vim(py3):SystemError: error return without exception set") |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1123 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1124 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1125 " Vars |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1126 func Test_python3_vars() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1127 let g:foo = 'bac' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1128 let w:abc3 = 'def' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1129 let b:baz = 'bar' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1130 let t:bar = 'jkl' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1131 try |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1132 throw "Abc" |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1133 catch /Abc/ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1134 call assert_equal('Abc', py3eval('vim.vvars[''exception'']')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1135 endtry |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1136 call assert_equal('bac', py3eval('vim.vars[''foo'']')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1137 call assert_equal('def', py3eval('vim.current.window.vars[''abc3'']')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1138 call assert_equal('bar', py3eval('vim.current.buffer.vars[''baz'']')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1139 call assert_equal('jkl', py3eval('vim.current.tabpage.vars[''bar'']')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1140 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1141 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1142 " Options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1143 " paste: boolean, global |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1144 " previewheight number, global |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1145 " operatorfunc: string, global |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1146 " number: boolean, window-local |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1147 " numberwidth: number, window-local |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1148 " colorcolumn: string, window-local |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1149 " statusline: string, window-local/global |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1150 " autoindent: boolean, buffer-local |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1151 " shiftwidth: number, buffer-local |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1152 " omnifunc: string, buffer-local |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1153 " preserveindent: boolean, buffer-local/global |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1154 " path: string, buffer-local/global |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1155 func Test_python3_opts() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1156 let g:res = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1157 let g:bufs = [bufnr('%')] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1158 new |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1159 let g:bufs += [bufnr('%')] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1160 vnew |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1161 let g:bufs += [bufnr('%')] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1162 wincmd j |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1163 vnew |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1164 let g:bufs += [bufnr('%')] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1165 wincmd l |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1166 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1167 func RecVars(opt) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1168 let gval = string(eval('&g:' .. a:opt)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1169 let wvals = join(map(range(1, 4), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1170 \ 'v:val .. ":" .. string(getwinvar(v:val, "&" .. a:opt))')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1171 let bvals = join(map(copy(g:bufs), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1172 \ 'v:val .. ":" .. string(getbufvar(v:val, "&" .. a:opt))')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1173 call add(g:res, ' G: ' .. gval) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1174 call add(g:res, ' W: ' .. wvals) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1175 call add(g:res, ' B: ' .. wvals) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1176 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1177 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1178 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1179 def e(s, g=globals(), l=locals()): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1180 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1181 exec(s, g, l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1182 except Exception as e: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1183 vim.command('return ' + repr(e.__class__.__name__)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1184 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1185 def ev(s, g=globals(), l=locals()): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1186 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1187 return eval(s, g, l) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1188 except Exception as e: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1189 vim.command('let exc=' + repr(e.__class__.__name__)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1190 return 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1191 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1192 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1193 func E(s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1194 python3 e(vim.eval('a:s')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1195 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1196 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1197 func Ev(s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1198 let r = py3eval('ev(vim.eval("a:s"))') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1199 if exists('exc') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1200 throw exc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1201 endif |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1202 return r |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1203 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1204 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1205 py3 gopts1 = vim.options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1206 py3 wopts1 = vim.windows[2].options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1207 py3 wopts2 = vim.windows[0].options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1208 py3 wopts3 = vim.windows[1].options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1209 py3 bopts1 = vim.buffers[vim.bindeval("g:bufs")[2]].options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1210 py3 bopts2 = vim.buffers[vim.bindeval("g:bufs")[1]].options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1211 py3 bopts3 = vim.buffers[vim.bindeval("g:bufs")[0]].options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1212 call add(g:res, 'wopts iters equal: ' .. |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1213 \ py3eval('list(wopts1) == list(wopts2)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1214 call add(g:res, 'bopts iters equal: ' .. |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1215 \ py3eval('list(bopts1) == list(bopts2)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1216 py3 gset = set(iter(gopts1)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1217 py3 wset = set(iter(wopts1)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1218 py3 bset = set(iter(bopts1)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1219 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1220 set path=.,..,, |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1221 let lst = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1222 let lst += [['paste', 1, 0, 1, 2, 1, 1, 0]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1223 let lst += [['previewheight', 5, 1, 6, 'a', 0, 1, 0]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1224 let lst += [['operatorfunc', 'A', 'B', 'C', 2, 0, 1, 0]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1225 let lst += [['number', 0, 1, 1, 0, 1, 0, 1]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1226 let lst += [['numberwidth', 2, 3, 5, -100, 0, 0, 1]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1227 let lst += [['colorcolumn', '+1', '+2', '+3', 'abc4', 0, 0, 1]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1228 let lst += [['statusline', '1', '2', '4', 0, 0, 1, 1]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1229 let lst += [['autoindent', 0, 1, 1, 2, 1, 0, 2]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1230 let lst += [['shiftwidth', 0, 2, 1, 3, 0, 0, 2]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1231 let lst += [['omnifunc', 'A', 'B', 'C', 1, 0, 0, 2]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1232 let lst += [['preserveindent', 0, 1, 1, 2, 1, 1, 2]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1233 let lst += [['path', '.,,', ',,', '.', 0, 0, 1, 2]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1234 for [oname, oval1, oval2, oval3, invval, bool, global, local] in lst |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1235 py3 oname = vim.eval('oname') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1236 py3 oval1 = vim.bindeval('oval1') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1237 py3 oval2 = vim.bindeval('oval2') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1238 py3 oval3 = vim.bindeval('oval3') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1239 if invval is 0 || invval is 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1240 py3 invval = bool(vim.bindeval('invval')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1241 else |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1242 py3 invval = vim.bindeval('invval') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1243 endif |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1244 if bool |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1245 py3 oval1 = bool(oval1) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1246 py3 oval2 = bool(oval2) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1247 py3 oval3 = bool(oval3) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1248 endif |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1249 call add(g:res, '>>> ' .. oname) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1250 call add(g:res, ' g/w/b:' .. py3eval('oname in gset') .. '/' .. |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1251 \ py3eval('oname in wset') .. '/' .. py3eval('oname in bset')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1252 call add(g:res, ' g/w/b (in):' .. py3eval('oname in gopts1') .. '/' .. |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1253 \ py3eval('oname in wopts1') .. '/' .. py3eval('oname in bopts1')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1254 for v in ['gopts1', 'wopts1', 'bopts1'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1255 try |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1256 call add(g:res, ' p/' .. v .. ': ' .. Ev('repr(' .. v .. '[''' .. oname .. '''])')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1257 catch |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1258 call add(g:res, ' p/' .. v .. '! ' .. v:exception) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1259 endtry |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1260 let r = E(v .. '[''' .. oname .. ''']=invval') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1261 if r isnot 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1262 call add(g:res, ' inv: ' .. string(invval) .. '! ' .. r) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1263 endif |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1264 for vv in (v is# 'gopts1' ? [v] : [v, v[:-2] .. '2', v[:-2] .. '3']) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1265 let val = substitute(vv, '^.opts', 'oval', '') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1266 let r = E(vv .. '[''' .. oname .. ''']=' .. val) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1267 if r isnot 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1268 call add(g:res, ' ' .. vv .. '! ' .. r) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1269 endif |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1270 endfor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1271 endfor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1272 call RecVars(oname) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1273 for v in ['wopts3', 'bopts3'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1274 let r = E('del ' .. v .. '["' .. oname .. '"]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1275 if r isnot 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1276 call add(g:res, ' del ' .. v .. '! ' .. r) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1277 endif |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1278 endfor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1279 call RecVars(oname) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1280 endfor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1281 delfunction RecVars |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1282 delfunction E |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1283 delfunction Ev |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1284 py3 del ev |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1285 py3 del e |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1286 only |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1287 for buf in g:bufs[1:] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1288 execute 'bwipeout!' buf |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1289 endfor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1290 py3 del gopts1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1291 py3 del wopts1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1292 py3 del wopts2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1293 py3 del wopts3 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1294 py3 del bopts1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1295 py3 del bopts2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1296 py3 del bopts3 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1297 py3 del oval1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1298 py3 del oval2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1299 py3 del oval3 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1300 py3 del oname |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1301 py3 del invval |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1302 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1303 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1304 wopts iters equal: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1305 bopts iters equal: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1306 >>> paste |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1307 g/w/b:1/0/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1308 g/w/b (in):1/0/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1309 p/gopts1: False |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1310 p/wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1311 inv: 2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1312 wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1313 wopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1314 wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1315 p/bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1316 inv: 2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1317 bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1318 bopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1319 bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1320 G: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1321 W: 1:1 2:1 3:1 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1322 B: 1:1 2:1 3:1 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1323 del wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1324 del bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1325 G: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1326 W: 1:1 2:1 3:1 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1327 B: 1:1 2:1 3:1 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1328 >>> previewheight |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1329 g/w/b:1/0/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1330 g/w/b (in):1/0/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1331 p/gopts1: 12 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1332 inv: 'a'! TypeError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1333 p/wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1334 inv: 'a'! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1335 wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1336 wopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1337 wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1338 p/bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1339 inv: 'a'! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1340 bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1341 bopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1342 bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1343 G: 5 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1344 W: 1:5 2:5 3:5 4:5 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1345 B: 1:5 2:5 3:5 4:5 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1346 del wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1347 del bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1348 G: 5 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1349 W: 1:5 2:5 3:5 4:5 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1350 B: 1:5 2:5 3:5 4:5 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1351 >>> operatorfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1352 g/w/b:1/0/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1353 g/w/b (in):1/0/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1354 p/gopts1: b'' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1355 inv: 2! TypeError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1356 p/wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1357 inv: 2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1358 wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1359 wopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1360 wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1361 p/bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1362 inv: 2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1363 bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1364 bopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1365 bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1366 G: 'A' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1367 W: 1:'A' 2:'A' 3:'A' 4:'A' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1368 B: 1:'A' 2:'A' 3:'A' 4:'A' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1369 del wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1370 del bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1371 G: 'A' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1372 W: 1:'A' 2:'A' 3:'A' 4:'A' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1373 B: 1:'A' 2:'A' 3:'A' 4:'A' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1374 >>> number |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1375 g/w/b:0/1/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1376 g/w/b (in):0/1/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1377 p/gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1378 inv: 0! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1379 gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1380 p/wopts1: False |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1381 p/bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1382 inv: 0! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1383 bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1384 bopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1385 bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1386 G: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1387 W: 1:1 2:1 3:0 4:0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1388 B: 1:1 2:1 3:0 4:0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1389 del wopts3! ValueError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1390 del bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1391 G: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1392 W: 1:1 2:1 3:0 4:0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1393 B: 1:1 2:1 3:0 4:0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1394 >>> numberwidth |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1395 g/w/b:0/1/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1396 g/w/b (in):0/1/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1397 p/gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1398 inv: -100! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1399 gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1400 p/wopts1: 4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1401 inv: -100! error |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1402 p/bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1403 inv: -100! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1404 bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1405 bopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1406 bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1407 G: 4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1408 W: 1:3 2:5 3:2 4:4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1409 B: 1:3 2:5 3:2 4:4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1410 del wopts3! ValueError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1411 del bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1412 G: 4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1413 W: 1:3 2:5 3:2 4:4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1414 B: 1:3 2:5 3:2 4:4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1415 >>> colorcolumn |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1416 g/w/b:0/1/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1417 g/w/b (in):0/1/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1418 p/gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1419 inv: 'abc4'! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1420 gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1421 p/wopts1: b'' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1422 inv: 'abc4'! error |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1423 p/bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1424 inv: 'abc4'! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1425 bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1426 bopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1427 bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1428 G: '' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1429 W: 1:'+2' 2:'+3' 3:'+1' 4:'' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1430 B: 1:'+2' 2:'+3' 3:'+1' 4:'' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1431 del wopts3! ValueError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1432 del bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1433 G: '' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1434 W: 1:'+2' 2:'+3' 3:'+1' 4:'' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1435 B: 1:'+2' 2:'+3' 3:'+1' 4:'' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1436 >>> statusline |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1437 g/w/b:1/1/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1438 g/w/b (in):1/1/0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1439 p/gopts1: b'' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1440 inv: 0! TypeError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1441 p/wopts1: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1442 inv: 0! TypeError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1443 p/bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1444 inv: 0! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1445 bopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1446 bopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1447 bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1448 G: '1' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1449 W: 1:'2' 2:'4' 3:'1' 4:'1' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1450 B: 1:'2' 2:'4' 3:'1' 4:'1' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1451 del bopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1452 G: '1' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1453 W: 1:'2' 2:'1' 3:'1' 4:'1' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1454 B: 1:'2' 2:'1' 3:'1' 4:'1' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1455 >>> autoindent |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1456 g/w/b:0/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1457 g/w/b (in):0/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1458 p/gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1459 inv: 2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1460 gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1461 p/wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1462 inv: 2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1463 wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1464 wopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1465 wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1466 p/bopts1: False |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1467 G: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1468 W: 1:0 2:1 3:0 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1469 B: 1:0 2:1 3:0 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1470 del wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1471 del bopts3! ValueError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1472 G: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1473 W: 1:0 2:1 3:0 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1474 B: 1:0 2:1 3:0 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1475 >>> shiftwidth |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1476 g/w/b:0/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1477 g/w/b (in):0/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1478 p/gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1479 inv: 3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1480 gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1481 p/wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1482 inv: 3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1483 wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1484 wopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1485 wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1486 p/bopts1: 8 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1487 G: 8 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1488 W: 1:0 2:2 3:8 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1489 B: 1:0 2:2 3:8 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1490 del wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1491 del bopts3! ValueError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1492 G: 8 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1493 W: 1:0 2:2 3:8 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1494 B: 1:0 2:2 3:8 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1495 >>> omnifunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1496 g/w/b:0/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1497 g/w/b (in):0/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1498 p/gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1499 inv: 1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1500 gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1501 p/wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1502 inv: 1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1503 wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1504 wopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1505 wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1506 p/bopts1: b'' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1507 inv: 1! TypeError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1508 G: '' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1509 W: 1:'A' 2:'B' 3:'' 4:'C' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1510 B: 1:'A' 2:'B' 3:'' 4:'C' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1511 del wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1512 del bopts3! ValueError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1513 G: '' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1514 W: 1:'A' 2:'B' 3:'' 4:'C' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1515 B: 1:'A' 2:'B' 3:'' 4:'C' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1516 >>> preserveindent |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1517 g/w/b:0/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1518 g/w/b (in):0/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1519 p/gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1520 inv: 2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1521 gopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1522 p/wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1523 inv: 2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1524 wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1525 wopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1526 wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1527 p/bopts1: False |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1528 G: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1529 W: 1:0 2:1 3:0 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1530 B: 1:0 2:1 3:0 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1531 del wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1532 del bopts3! ValueError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1533 G: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1534 W: 1:0 2:1 3:0 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1535 B: 1:0 2:1 3:0 4:1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1536 >>> path |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1537 g/w/b:1/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1538 g/w/b (in):1/0/1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1539 p/gopts1: b'.,..,,' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1540 inv: 0! TypeError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1541 p/wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1542 inv: 0! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1543 wopts1! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1544 wopts2! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1545 wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1546 p/bopts1: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1547 inv: 0! TypeError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1548 G: '.,,' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1549 W: 1:'.,,' 2:',,' 3:'.,,' 4:'.' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1550 B: 1:'.,,' 2:',,' 3:'.,,' 4:'.' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1551 del wopts3! KeyError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1552 G: '.,,' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1553 W: 1:'.,,' 2:',,' 3:'.,,' 4:'.,,' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1554 B: 1:'.,,' 2:',,' 3:'.,,' 4:'.,,' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1555 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1556 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1557 call assert_equal(expected, g:res) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1558 unlet g:res |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1559 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1560 call assert_equal(0, py3eval("'' in vim.options")) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1561 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1562 " 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
|
1563 call AssertException(["let v = py3eval(\"vim.options['']\")"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1564 \ '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
|
1565 call AssertException(["py3 vim.current.window.options[''] = 0"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1566 \ 'Vim(py3):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
|
1567 call AssertException(["py3 vim.current.window.options[{}] = 0"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1568 \ 'Vim(py3):TypeError: expected bytes() or str() instance, but got dict') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1569 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1570 " 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
|
1571 let cmd = ["py3 vim.options['previewheight'] = 9999999999999999"] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1572 call AssertException(cmd, "Vim(py3):OverflowError:") |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1573 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1574 " 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
|
1575 call AssertException(["py3 del vim.options['errorformat']"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1576 \ 'Vim(py3):ValueError: unable to unset global option errorformat') |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1577 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1578 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1579 " Test for vim.buffer object |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1580 func Test_python3_buffer() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1581 new |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1582 call setline(1, "Hello\nWorld") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1583 call assert_fails("let x = py3eval('vim.current.buffer[0]')", 'E859:') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1584 %bw! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1585 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1586 edit Xfile1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1587 let bnr1 = bufnr() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1588 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1589 vnew Xfile2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1590 let bnr2 = bufnr() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1591 call setline(1, ['First line', 'Second line', 'Third line']) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1592 py3 b = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1593 wincmd w |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1594 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1595 " 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
|
1596 call assert_equal(['First line'], py3eval('b[-10:1]')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1597 call assert_equal(['Third line'], py3eval('b[2:10]')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1598 call assert_equal([], py3eval('b[2:0]')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1599 call assert_equal([], py3eval('b[10:12]')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1600 call assert_equal([], py3eval('b[-10:-8]')) |
21200
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1601 call AssertException(["py3 x = b[0:3:0]"], |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1602 \ 'Vim(py3):ValueError: slice step cannot be zero') |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1603 call AssertException(["py3 b[0:3:0] = 'abc'"], |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1604 \ 'Vim(py3):ValueError: slice step cannot be zero') |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1605 call AssertException(["py3 x = b[{}]"], |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1606 \ 'Vim(py3):TypeError: index must be int or slice, not dict') |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1607 call AssertException(["py3 b[{}] = 'abc'"], |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1608 \ 'Vim(py3):TypeError: index must be int or slice, not dict') |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1609 |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1610 " 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
|
1611 call AssertException(["py3 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
|
1612 \ "Vim(py3):ValueError: slice step cannot be zero") |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1613 call AssertException(["py3 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
|
1614 \ "Vim(py3):ValueError: slice step cannot be zero") |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1615 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1616 " Tests BufferAppend and BufferItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1617 py3 cb.append(b[0]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1618 call assert_equal(['First line'], getbufline(bnr1, 2)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1619 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1620 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1621 " 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
|
1622 call AssertException(["py3 b.append('abc', 10)"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1623 \ 'Vim(py3):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
|
1624 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1625 " Append a non-string item |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1626 call AssertException(["py3 b.append([22])"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1627 \ 'Vim(py3):TypeError: expected bytes() or str() instance, but got int') |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1628 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1629 " Tests BufferSlice and BufferAssSlice |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1630 py3 cb.append('abc5') # Will be overwritten |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1631 py3 cb[-1:] = b[:-2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1632 call assert_equal(['First line'], getbufline(bnr1, 2)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1633 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1634 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1635 " Test BufferLength and BufferAssSlice |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1636 py3 cb.append('def') # Will not be overwritten |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1637 py3 cb[len(cb):] = b[:] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1638 call assert_equal(['def', 'First line', 'Second line', 'Third line'], |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1639 \ getbufline(bnr1, 2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1640 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1641 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1642 " Test BufferAssItem and BufferMark |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1643 call setbufline(bnr1, 1, ['one', 'two', 'three']) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1644 call cursor(1, 3) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1645 normal ma |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1646 py3 cb.append('ghi') # Will be overwritten |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1647 py3 cb[-1] = repr((len(cb) - cb.mark('a')[0], cb.mark('a')[1])) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1648 call assert_equal(['(3, 2)'], getbufline(bnr1, 4)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1649 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1650 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1651 " Test BufferRepr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1652 py3 cb.append(repr(cb) + repr(b)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1653 call assert_equal(['<buffer Xfile1><buffer Xfile2>'], getbufline(bnr1, 2)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1654 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1655 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1656 " Modify foreign buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1657 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1658 b.append('foo') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1659 b[0]='bar' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1660 b[0:0]=['baz'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1661 vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1662 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1663 call assert_equal(['baz', 'bar', 'Second line', 'Third line', 'foo'], |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1664 \ getbufline(bnr2, 1, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1665 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1666 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1667 " Test assigning to name property |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1668 augroup BUFS |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1669 autocmd BufFilePost * python3 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:
20233
diff
changeset
|
1670 autocmd BufFilePre * python3 cb.append(vim.eval('expand("<abuf>")') + ':BufFilePre:' + vim.eval('bufnr("%")')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1671 augroup END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1672 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1673 import os |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1674 old_name = cb.name |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1675 cb.name = 'foo' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1676 cb.append(cb.name[-11:].replace(os.path.sep, '/')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1677 b.name = 'bar' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1678 cb.append(b.name[-11:].replace(os.path.sep, '/')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1679 cb.name = old_name |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1680 cb.append(cb.name[-14:].replace(os.path.sep, '/')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1681 del old_name |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1682 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1683 call assert_equal([bnr1 .. ':BufFilePre:' .. bnr1, |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1684 \ bnr1 .. ':BufFilePost:' .. bnr1, |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1685 \ 'testdir/foo', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1686 \ bnr2 .. ':BufFilePre:' .. bnr2, |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1687 \ bnr2 .. ':BufFilePost:' .. bnr2, |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1688 \ 'testdir/bar', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1689 \ bnr1 .. ':BufFilePre:' .. bnr1, |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1690 \ bnr1 .. ':BufFilePost:' .. bnr1, |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1691 \ 'testdir/Xfile1'], getbufline(bnr1, 2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1692 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1693 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1694 " Test CheckBuffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1695 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1696 for _b in vim.buffers: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1697 if _b is not cb: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1698 vim.command('bwipeout! ' + str(_b.number)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1699 del _b |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1700 cb.append('valid: b:%s, cb:%s' % (repr(b.valid), repr(cb.valid))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1701 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1702 call assert_equal('valid: b:False, cb:True', getline(2)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1703 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1704 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1705 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1706 for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc6")'): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1707 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1708 exec(expr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1709 except vim.error: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1710 pass |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1711 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1712 # Usually a SEGV here |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1713 # Should not happen in any case |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1714 cb.append('No exception for ' + expr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1715 vim.command('cd .') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1716 del b |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1717 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1718 call assert_equal([''], getline(1, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1719 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1720 " 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
|
1721 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
|
1722 py3 vim.current.buffer[:] = [] |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1723 call assert_equal([''], getline(1, '$')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1724 |
21200
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1725 " Test for buffer marks |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1726 call assert_equal(v:none, py3eval("vim.current.buffer.mark('r')")) |
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
1727 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1728 " 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
|
1729 setlocal nomodifiable |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1730 call AssertException(["py3 vim.current.buffer[0] = 'abc'"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1731 \ "Vim(py3):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
|
1732 call AssertException(["py3 vim.current.buffer[0] = None"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1733 \ "Vim(py3):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
|
1734 call AssertException(["py3 vim.current.buffer[:] = None"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1735 \ "Vim(py3):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
|
1736 call AssertException(["py3 vim.current.buffer[:] = []"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1737 \ "Vim(py3):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
|
1738 call AssertException(["py3 vim.current.buffer.append('abc')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1739 \ "Vim(py3):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
|
1740 call AssertException(["py3 vim.current.buffer.append([])"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1741 \ "Vim(py3):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
|
1742 setlocal modifiable |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1743 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1744 augroup BUFS |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1745 autocmd! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1746 augroup END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1747 augroup! BUFS |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1748 %bw! |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1749 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1750 " Range object for a deleted buffer |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1751 new Xfile |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1752 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
|
1753 py3 b = vim.current.buffer |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1754 py3 r = vim.current.buffer.range(0, 2) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1755 call assert_equal('<range Xfile (0:2)>', py3eval('repr(r)')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1756 %bw! |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1757 call AssertException(['py3 r[:] = []'], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1758 \ 'Vim(py3):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
|
1759 call assert_match('<buffer object (deleted)', py3eval('repr(b)')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1760 call assert_match('<range object (for deleted buffer)', py3eval('repr(r)')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1761 call AssertException(["let n = py3eval('len(r)')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1762 \ '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
|
1763 call AssertException(["py3 r.append('abc')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1764 \ 'Vim(py3):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
|
1765 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1766 " object for a deleted buffer |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1767 call AssertException(["py3 b[0] = 'one'"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1768 \ 'Vim(py3):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
|
1769 call AssertException(["py3 b.append('one')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1770 \ 'Vim(py3):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
|
1771 call AssertException(["let n = py3eval('len(b)')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1772 \ '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
|
1773 call AssertException(["py3 pos = b.mark('a')"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1774 \ 'Vim(py3):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
|
1775 call AssertException(["py3 vim.current.buffer = b"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1776 \ 'Vim(py3):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
|
1777 call AssertException(["py3 rn = b.range(0, 2)"], |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
1778 \ 'Vim(py3):vim.error: attempt to refer to deleted buffer') |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1779 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1780 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1781 " Test vim.buffers object |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1782 func Test_python3_buffers() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1783 %bw! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1784 edit Xfile |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1785 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1786 set hidden |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1787 edit a |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1788 buffer # |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1789 edit b |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1790 buffer # |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1791 edit c |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1792 buffer # |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1793 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1794 # Check GCing iterator that was not fully exhausted |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1795 i = iter(vim.buffers) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1796 cb.append('i:' + str(next(i))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1797 # and also check creating more than one iterator at a time |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1798 i2 = iter(vim.buffers) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1799 cb.append('i2:' + str(next(i2))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1800 cb.append('i:' + str(next(i))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1801 # The following should trigger GC and not cause any problems |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1802 del i |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1803 del i2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1804 i3 = iter(vim.buffers) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1805 cb.append('i3:' + str(next(i3))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1806 del i3 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1807 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1808 call assert_equal(['i:<buffer Xfile>', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1809 \ 'i2:<buffer Xfile>', 'i:<buffer a>', 'i3:<buffer Xfile>'], |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1810 \ getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1811 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1812 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1813 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1814 prevnum = 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1815 for b in vim.buffers: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1816 # Check buffer order |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1817 if prevnum >= b.number: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1818 cb.append('!!! Buffer numbers not in strictly ascending order') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1819 # Check indexing: vim.buffers[number].number == number |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1820 cb.append(str(b.number) + ':' + repr(vim.buffers[b.number]) + \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1821 '=' + repr(b)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1822 prevnum = b.number |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1823 del prevnum |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1824 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1825 cb.append(str(len(vim.buffers))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1826 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1827 call assert_equal([bufnr('Xfile') .. ':<buffer Xfile>=<buffer Xfile>', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1828 \ bufnr('a') .. ':<buffer a>=<buffer a>', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1829 \ bufnr('b') .. ':<buffer b>=<buffer b>', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1830 \ bufnr('c') .. ':<buffer c>=<buffer c>', '4'], getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1831 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1832 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1833 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1834 bnums = list(map(lambda b: b.number, vim.buffers))[1:] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1835 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1836 # Test wiping out buffer with existing iterator |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1837 i4 = iter(vim.buffers) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1838 cb.append('i4:' + str(next(i4))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1839 vim.command('bwipeout! ' + str(bnums.pop(0))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1840 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1841 next(i4) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1842 except vim.error: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1843 pass |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1844 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1845 cb.append('!!!! No vim.error') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1846 i4 = iter(vim.buffers) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1847 vim.command('bwipeout! ' + str(bnums.pop(-1))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1848 vim.command('bwipeout! ' + str(bnums.pop(-1))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1849 cb.append('i4:' + str(next(i4))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1850 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1851 next(i4) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1852 except StopIteration: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1853 cb.append('StopIteration') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1854 del i4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1855 del bnums |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1856 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1857 call assert_equal(['i4:<buffer Xfile>', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1858 \ 'i4:<buffer Xfile>', 'StopIteration'], getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1859 %bw! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1860 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1861 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1862 " Test vim.{tabpage,window}list and vim.{tabpage,window} objects |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1863 func Test_python3_tabpage_window() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1864 %bw |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1865 edit Xfile |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1866 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1867 tabnew 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1868 tabnew 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1869 vnew a.1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1870 tabnew 2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1871 vnew a.2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1872 vnew b.2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1873 vnew c.2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1874 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1875 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1876 cb.append('Number of tabs: ' + str(len(vim.tabpages))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1877 cb.append('Current tab pages:') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1878 def W(w): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1879 if '(unknown)' in repr(w): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1880 return '<window object (unknown)>' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1881 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1882 return repr(w) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1883 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1884 def Cursor(w, start=len(cb)): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1885 if w.buffer is cb: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1886 return repr((start - w.cursor[0], w.cursor[1])) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1887 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1888 return repr(w.cursor) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1889 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1890 for t in vim.tabpages: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1891 cb.append(' ' + repr(t) + '(' + str(t.number) + ')' + ': ' + \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1892 str(len(t.windows)) + ' windows, current is ' + W(t.window)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1893 cb.append(' Windows:') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1894 for w in t.windows: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1895 cb.append(' ' + W(w) + '(' + str(w.number) + ')' + \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1896 ': displays buffer ' + repr(w.buffer) + \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1897 '; cursor is at ' + Cursor(w)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1898 # Other values depend on the size of the terminal, so they are checked |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1899 # partly: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1900 for attr in ('height', 'row', 'width', 'col'): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1901 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1902 aval = getattr(w, attr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1903 if type(aval) is not int: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1904 raise TypeError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1905 if aval < 0: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1906 raise ValueError |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1907 except Exception as e: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1908 cb.append('!!!!!! Error while getting attribute ' + attr + \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1909 ': ' + e.__class__.__name__) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1910 del aval |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1911 del attr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1912 w.cursor = (len(w.buffer), 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1913 del W |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1914 del Cursor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1915 cb.append('Number of windows in current tab page: ' + \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1916 str(len(vim.windows))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1917 if list(vim.windows) != list(vim.current.tabpage.windows): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1918 cb.append('!!!!!! Windows differ') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1919 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1920 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1921 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1922 Number of tabs: 4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1923 Current tab pages: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1924 <tabpage 0>(1): 1 windows, current is <window object (unknown)> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1925 Windows: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1926 <window object (unknown)>(1): displays buffer <buffer Xfile>; cursor is at (2, 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1927 <tabpage 1>(2): 1 windows, current is <window object (unknown)> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1928 Windows: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1929 <window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1930 <tabpage 2>(3): 2 windows, current is <window object (unknown)> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1931 Windows: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1932 <window object (unknown)>(1): displays buffer <buffer a.1>; cursor is at (1, 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1933 <window object (unknown)>(2): displays buffer <buffer 1>; cursor is at (1, 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1934 <tabpage 3>(4): 4 windows, current is <window 0> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1935 Windows: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1936 <window 0>(1): displays buffer <buffer c.2>; cursor is at (1, 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1937 <window 1>(2): displays buffer <buffer b.2>; cursor is at (1, 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1938 <window 2>(3): displays buffer <buffer a.2>; cursor is at (1, 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1939 <window 3>(4): displays buffer <buffer 2>; cursor is at (1, 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1940 Number of windows in current tab page: 4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1941 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1942 call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1943 %bw! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1944 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1945 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1946 " Test vim.current |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1947 func Test_python3_vim_current() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1948 %bw |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1949 edit Xfile |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1950 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1951 tabnew 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1952 tabnew 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1953 vnew a.1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1954 tabnew 2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1955 vnew a.2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1956 vnew b.2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1957 vnew c.2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1958 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1959 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1960 def H(o): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1961 return repr(o) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1962 cb.append('Current tab page: ' + repr(vim.current.tabpage)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1963 cb.append('Current window: ' + repr(vim.current.window) + ': ' + \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1964 H(vim.current.window) + ' is ' + H(vim.current.tabpage.window)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1965 cb.append('Current buffer: ' + repr(vim.current.buffer) + ': ' + \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1966 H(vim.current.buffer) + ' is ' + H(vim.current.window.buffer)+ \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1967 ' is ' + H(vim.current.tabpage.window.buffer)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1968 del H |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1969 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1970 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1971 Current tab page: <tabpage 3> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1972 Current window: <window 0>: <window 0> is <window 0> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1973 Current buffer: <buffer c.2>: <buffer c.2> is <buffer c.2> is <buffer c.2> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1974 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1975 call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1976 call deletebufline(bufnr('Xfile'), 1, '$') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1977 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1978 " Assigning: fails |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1979 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1980 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1981 vim.current.window = vim.tabpages[0].window |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1982 except ValueError: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1983 cb.append('ValueError at assigning foreign tab window') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1984 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1985 for attr in ('window', 'tabpage', 'buffer'): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1986 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1987 setattr(vim.current, attr, None) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1988 except TypeError: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1989 cb.append('Type error at assigning None to vim.current.' + attr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1990 del attr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1991 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1992 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1993 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1994 ValueError at assigning foreign tab window |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1995 Type error at assigning None to vim.current.window |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1996 Type error at assigning None to vim.current.tabpage |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1997 Type error at assigning None to vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1998 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
1999 call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2000 call deletebufline(bufnr('Xfile'), 1, '$') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2001 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2002 call setbufline(bufnr('Xfile'), 1, 'python interface') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2003 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2004 # Assigning: success |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2005 vim.current.tabpage = vim.tabpages[-2] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2006 vim.current.buffer = cb |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2007 vim.current.window = vim.windows[0] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2008 vim.current.window.cursor = (len(vim.current.buffer), 0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2009 cb.append('Current tab page: ' + repr(vim.current.tabpage)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2010 cb.append('Current window: ' + repr(vim.current.window)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2011 cb.append('Current buffer: ' + repr(vim.current.buffer)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2012 cb.append('Current line: ' + repr(vim.current.line)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2013 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2014 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2015 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2016 Current tab page: <tabpage 2> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2017 Current window: <window 0> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2018 Current buffer: <buffer Xfile> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2019 Current line: 'python interface' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2020 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2021 call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
2022 py3 vim.current.line = 'one line' |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
2023 call assert_equal('one line', getline('.')) |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2024 call deletebufline(bufnr('Xfile'), 1, '$') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2025 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2026 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2027 ws = list(vim.windows) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2028 ts = list(vim.tabpages) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2029 for b in vim.buffers: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2030 if b is not cb: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2031 vim.command('bwipeout! ' + str(b.number)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2032 del b |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2033 cb.append('w.valid: ' + repr([w.valid for w in ws])) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2034 cb.append('t.valid: ' + repr([t.valid for t in ts])) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2035 del w |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2036 del t |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2037 del ts |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2038 del ws |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2039 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2040 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2041 w.valid: [True, False] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2042 t.valid: [True, False, True, False] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2043 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2044 call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2045 %bw! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2046 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2047 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2048 " Test types |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2049 func Test_python3_types() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2050 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2051 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2052 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2053 for expr, attr in ( |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2054 ('vim.vars', 'Dictionary'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2055 ('vim.options', 'Options'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2056 ('vim.bindeval("{}")', 'Dictionary'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2057 ('vim.bindeval("[]")', 'List'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2058 ('vim.bindeval("function(\'tr\')")', 'Function'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2059 ('vim.current.buffer', 'Buffer'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2060 ('vim.current.range', 'Range'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2061 ('vim.current.window', 'Window'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2062 ('vim.current.tabpage', 'TabPage'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2063 ): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2064 cb.append(expr + ':' + attr + ':' + \ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2065 repr(type(eval(expr)) is getattr(vim, attr))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2066 del expr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2067 del attr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2068 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2069 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2070 vim.vars:Dictionary:True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2071 vim.options:Options:True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2072 vim.bindeval("{}"):Dictionary:True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2073 vim.bindeval("[]"):List:True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2074 vim.bindeval("function('tr')"):Function:True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2075 vim.current.buffer:Buffer:True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2076 vim.current.range:Range:True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2077 vim.current.window:Window:True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2078 vim.current.tabpage:TabPage:True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2079 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2080 call assert_equal(expected, getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2081 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2082 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2083 " Test __dir__() method |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2084 func Test_python3_dir_method() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2085 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2086 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2087 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2088 for name, o in ( |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2089 ('current', vim.current), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2090 ('buffer', vim.current.buffer), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2091 ('window', vim.current.window), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2092 ('tabpage', vim.current.tabpage), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2093 ('range', vim.current.range), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2094 ('dictionary', vim.bindeval('{}')), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2095 ('list', vim.bindeval('[]')), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2096 ('function', vim.bindeval('function("tr")')), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2097 ('output', sys.stdout), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2098 ): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2099 cb.append(name + ':' + ','.join(dir(o))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2100 del name |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2101 del o |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2102 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2103 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2104 current:__dir__,buffer,line,range,tabpage,window |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2105 buffer:__dir__,append,mark,name,number,options,range,valid,vars |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2106 window:__dir__,buffer,col,cursor,height,number,options,row,tabpage,valid,vars,width |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2107 tabpage:__dir__,number,valid,vars,window,windows |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2108 range:__dir__,append,end,start |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2109 dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2110 list:__dir__,extend,locked |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2111 function:__dir__,args,auto_rebind,self,softspace |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2112 output:__dir__,close,closed,flush,isatty,readable,seekable,softspace,writable,write,writelines |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2113 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2114 call assert_equal(expected, getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2115 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2116 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2117 " Test vim.*.__new__ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2118 func Test_python3_new() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2119 call assert_equal({}, py3eval('vim.Dictionary({})')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2120 call assert_equal({'a': 1}, py3eval('vim.Dictionary(a=1)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2121 call assert_equal({'a': 1}, py3eval('vim.Dictionary(((''a'', 1),))')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2122 call assert_equal([], py3eval('vim.List()')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2123 call assert_equal(['a', 'b', 'c', '7'], py3eval('vim.List(iter(''abc7''))')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2124 call assert_equal(function('tr'), py3eval('vim.Function(''tr'')')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2125 call assert_equal(function('tr', [123, 3, 4]), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2126 \ py3eval('vim.Function(''tr'', args=[123, 3, 4])')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2127 call assert_equal(function('tr'), py3eval('vim.Function(''tr'', args=[])')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2128 call assert_equal(function('tr', {}), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2129 \ py3eval('vim.Function(''tr'', self={})')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2130 call assert_equal(function('tr', [123, 3, 4], {}), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2131 \ py3eval('vim.Function(''tr'', args=[123, 3, 4], self={})')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2132 call assert_equal(function('tr'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2133 \ py3eval('vim.Function(''tr'', auto_rebind=False)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2134 call assert_equal(function('tr', [123, 3, 4]), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2135 \ py3eval('vim.Function(''tr'', args=[123, 3, 4], auto_rebind=False)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2136 call assert_equal(function('tr'), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2137 \ py3eval('vim.Function(''tr'', args=[], auto_rebind=False)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2138 call assert_equal(function('tr', {}), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2139 \ py3eval('vim.Function(''tr'', self={}, auto_rebind=False)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2140 call assert_equal(function('tr', [123, 3, 4], {}), |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2141 \ py3eval('vim.Function(''tr'', args=[123, 3, 4], self={}, auto_rebind=False)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2142 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2143 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2144 " Test vim.Function |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2145 func Test_python3_vim_func() |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
2146 func Args(...) |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2147 return a:000 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2148 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2149 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
2150 func SelfArgs(...) dict |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2151 return [a:000, self] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2152 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2153 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2154 " The following four lines should not crash |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2155 let Pt = function('tr', [[]], {'l': []}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2156 py3 Pt = vim.bindeval('Pt') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2157 unlet Pt |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2158 py3 del Pt |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2159 |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
2160 call assert_equal(3, py3eval('vim.strwidth("a\tb")')) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
2161 |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2162 %bw! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2163 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2164 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2165 def ecall(out_prefix, func, *args, **kwargs): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2166 line = out_prefix + ': ' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2167 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2168 ret = func(*args, **kwargs) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2169 except Exception: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2170 line += '!exception: ' + emsg(sys.exc_info()) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2171 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2172 line += '!result: ' + str(vim.Function('string')(ret), 'utf-8') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2173 cb.append(line) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2174 a = vim.Function('Args') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2175 pa1 = vim.Function('Args', args=['abcArgsPA1']) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2176 pa2 = vim.Function('Args', args=[]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2177 pa3 = vim.Function('Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2178 pa4 = vim.Function('Args', self={'abcSelfPA4': 'abcSelfPA4Val'}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2179 cb.append('a: ' + repr(a)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2180 cb.append('pa1: ' + repr(pa1)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2181 cb.append('pa2: ' + repr(pa2)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2182 cb.append('pa3: ' + repr(pa3)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2183 cb.append('pa4: ' + repr(pa4)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2184 sa = vim.Function('SelfArgs') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2185 psa1 = vim.Function('SelfArgs', args=['abcArgsPSA1']) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2186 psa2 = vim.Function('SelfArgs', args=[]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2187 psa3 = vim.Function('SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2188 psa4 = vim.Function('SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2189 psa5 = vim.Function('SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}, auto_rebind=0) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2190 psa6 = vim.Function('SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}, auto_rebind=()) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2191 psa7 = vim.Function('SelfArgs', args=['abcArgsPSA7'], auto_rebind=[]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2192 psa8 = vim.Function('SelfArgs', auto_rebind=False) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2193 psa9 = vim.Function('SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2194 psaA = vim.Function('SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto_rebind=1) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2195 psaB = vim.Function('SelfArgs', args=['abcArgsPSAB'], auto_rebind={'abcARPSAB': 'abcARPSABVal'}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2196 psaC = vim.Function('SelfArgs', auto_rebind=['abcARPSAC']) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2197 cb.append('sa: ' + repr(sa)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2198 cb.append('psa1: ' + repr(psa1)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2199 cb.append('psa2: ' + repr(psa2)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2200 cb.append('psa3: ' + repr(psa3)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2201 cb.append('psa4: ' + repr(psa4)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2202 cb.append('psa5: ' + repr(psa5)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2203 cb.append('psa6: ' + repr(psa6)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2204 cb.append('psa7: ' + repr(psa7)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2205 cb.append('psa8: ' + repr(psa8)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2206 cb.append('psa9: ' + repr(psa9)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2207 cb.append('psaA: ' + repr(psaA)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2208 cb.append('psaB: ' + repr(psaB)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2209 cb.append('psaC: ' + repr(psaC)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2210 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2211 psar = vim.Function('SelfArgs', args=[{'abcArgsPSAr': 'abcArgsPSArVal'}], self={'abcSelfPSAr': 'abcSelfPSArVal'}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2212 psar.args[0]['abcArgsPSAr2'] = [psar.self, psar.args[0]] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2213 psar.self['rec'] = psar |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2214 psar.self['self'] = psar.self |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2215 psar.self['args'] = psar.args |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2216 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2217 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2218 cb.append('psar: ' + repr(psar)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2219 except Exception: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2220 cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2221 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2222 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2223 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2224 a: <vim.Function 'Args'> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2225 pa1: <vim.Function 'Args', args=['abcArgsPA1']> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2226 pa2: <vim.Function 'Args'> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2227 pa3: <vim.Function 'Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'}> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2228 pa4: <vim.Function 'Args', self={'abcSelfPA4': 'abcSelfPA4Val'}> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2229 sa: <vim.Function 'SelfArgs'> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2230 psa1: <vim.Function 'SelfArgs', args=['abcArgsPSA1']> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2231 psa2: <vim.Function 'SelfArgs'> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2232 psa3: <vim.Function 'SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'}> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2233 psa4: <vim.Function 'SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'}> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2234 psa5: <vim.Function 'SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2235 psa6: <vim.Function 'SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2236 psa7: <vim.Function 'SelfArgs', args=['abcArgsPSA7']> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2237 psa8: <vim.Function 'SelfArgs'> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2238 psa9: <vim.Function 'SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2239 psaA: <vim.Function 'SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto_rebind=True> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2240 psaB: <vim.Function 'SelfArgs', args=['abcArgsPSAB']> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2241 psaC: <vim.Function 'SelfArgs'> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2242 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'}]}> |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2243 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2244 call assert_equal(expected, getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2245 %d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2246 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2247 call assert_equal(function('Args'), py3eval('a')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2248 call assert_equal(function('Args', ['abcArgsPA1']), py3eval('pa1')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2249 call assert_equal(function('Args'), py3eval('pa2')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2250 call assert_equal(function('Args', ['abcArgsPA3'], {'abcSelfPA3': 'abcSelfPA3Val'}), py3eval('pa3')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2251 call assert_equal(function('Args', {'abcSelfPA4': 'abcSelfPA4Val'}), py3eval('pa4')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2252 call assert_equal(function('SelfArgs'), py3eval('sa')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2253 call assert_equal(function('SelfArgs', ['abcArgsPSA1']), py3eval('psa1')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2254 call assert_equal(function('SelfArgs'), py3eval('psa2')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2255 call assert_equal(function('SelfArgs', ['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}), py3eval('psa3')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2256 call assert_equal(function('SelfArgs', {'abcSelfPSA4': 'abcSelfPSA4Val'}), py3eval('psa4')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2257 call assert_equal(function('SelfArgs', {'abcSelfPSA5': 'abcSelfPSA5Val'}), py3eval('psa5')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2258 call assert_equal(function('SelfArgs', ['abcArgsPSA6'], {'abcSelfPSA6': 'abcSelfPSA6Val'}), py3eval('psa6')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2259 call assert_equal(function('SelfArgs', ['abcArgsPSA7']), py3eval('psa7')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2260 call assert_equal(function('SelfArgs'), py3eval('psa8')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2261 call assert_equal(function('SelfArgs', {'abcSelfPSA9': 'abcSelfPSA9Val'}), py3eval('psa9')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2262 call assert_equal(function('SelfArgs', ['abcArgsPSAA'], {'abcSelfPSAA': 'abcSelfPSAAVal'}), py3eval('psaA')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2263 call assert_equal(function('SelfArgs', ['abcArgsPSAB']), py3eval('psaB')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2264 call assert_equal(function('SelfArgs'), py3eval('psaC')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2265 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2266 let res = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2267 for v in ['sa', 'psa1', 'psa2', 'psa3', 'psa4', 'psa5', 'psa6', 'psa7', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2268 \ 'psa8', 'psa9', 'psaA', 'psaB', 'psaC'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2269 let d = {'f': py3eval(v)} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2270 call add(res, 'd.' .. v .. '(): ' .. string(d.f())) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2271 endfor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2272 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2273 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2274 d.sa(): [[], {'f': function('SelfArgs')}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2275 d.psa1(): [['abcArgsPSA1'], {'f': function('SelfArgs', ['abcArgsPSA1'])}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2276 d.psa2(): [[], {'f': function('SelfArgs')}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2277 d.psa3(): [['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2278 d.psa4(): [[], {'abcSelfPSA4': 'abcSelfPSA4Val'}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2279 d.psa5(): [[], {'abcSelfPSA5': 'abcSelfPSA5Val'}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2280 d.psa6(): [['abcArgsPSA6'], {'abcSelfPSA6': 'abcSelfPSA6Val'}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2281 d.psa7(): [['abcArgsPSA7'], {'f': function('SelfArgs', ['abcArgsPSA7'])}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2282 d.psa8(): [[], {'f': function('SelfArgs')}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2283 d.psa9(): [[], {'f': function('SelfArgs', {'abcSelfPSA9': 'abcSelfPSA9Val'})}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2284 d.psaA(): [['abcArgsPSAA'], {'f': function('SelfArgs', ['abcArgsPSAA'], {'abcSelfPSAA': 'abcSelfPSAAVal'})}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2285 d.psaB(): [['abcArgsPSAB'], {'f': function('SelfArgs', ['abcArgsPSAB'])}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2286 d.psaC(): [[], {'f': function('SelfArgs')}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2287 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2288 call assert_equal(expected, res) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2289 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2290 py3 ecall('a()', a, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2291 py3 ecall('pa1()', pa1, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2292 py3 ecall('pa2()', pa2, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2293 py3 ecall('pa3()', pa3, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2294 py3 ecall('pa4()', pa4, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2295 py3 ecall('sa()', sa, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2296 py3 ecall('psa1()', psa1, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2297 py3 ecall('psa2()', psa2, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2298 py3 ecall('psa3()', psa3, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2299 py3 ecall('psa4()', psa4, ) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2300 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2301 py3 ecall('a(42, 43)', a, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2302 py3 ecall('pa1(42, 43)', pa1, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2303 py3 ecall('pa2(42, 43)', pa2, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2304 py3 ecall('pa3(42, 43)', pa3, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2305 py3 ecall('pa4(42, 43)', pa4, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2306 py3 ecall('sa(42, 43)', sa, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2307 py3 ecall('psa1(42, 43)', psa1, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2308 py3 ecall('psa2(42, 43)', psa2, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2309 py3 ecall('psa3(42, 43)', psa3, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2310 py3 ecall('psa4(42, 43)', psa4, 42, 43) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2311 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2312 py3 ecall('a(42, self={"20": 1})', a, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2313 py3 ecall('pa1(42, self={"20": 1})', pa1, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2314 py3 ecall('pa2(42, self={"20": 1})', pa2, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2315 py3 ecall('pa3(42, self={"20": 1})', pa3, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2316 py3 ecall('pa4(42, self={"20": 1})', pa4, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2317 py3 ecall('sa(42, self={"20": 1})', sa, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2318 py3 ecall('psa1(42, self={"20": 1})', psa1, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2319 py3 ecall('psa2(42, self={"20": 1})', psa2, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2320 py3 ecall('psa3(42, self={"20": 1})', psa3, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2321 py3 ecall('psa4(42, self={"20": 1})', psa4, 42, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2322 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2323 py3 ecall('a(self={"20": 1})', a, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2324 py3 ecall('pa1(self={"20": 1})', pa1, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2325 py3 ecall('pa2(self={"20": 1})', pa2, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2326 py3 ecall('pa3(self={"20": 1})', pa3, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2327 py3 ecall('pa4(self={"20": 1})', pa4, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2328 py3 ecall('sa(self={"20": 1})', sa, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2329 py3 ecall('psa1(self={"20": 1})', psa1, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2330 py3 ecall('psa2(self={"20": 1})', psa2, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2331 py3 ecall('psa3(self={"20": 1})', psa3, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2332 py3 ecall('psa4(self={"20": 1})', psa4, self={'20': 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2333 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2334 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2335 def s(v): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2336 if v is None: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2337 return repr(v) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2338 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2339 return str(vim.Function('string')(v), 'utf-8') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2340 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2341 cb.append('a.args: ' + s(a.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2342 cb.append('pa1.args: ' + s(pa1.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2343 cb.append('pa2.args: ' + s(pa2.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2344 cb.append('pa3.args: ' + s(pa3.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2345 cb.append('pa4.args: ' + s(pa4.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2346 cb.append('sa.args: ' + s(sa.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2347 cb.append('psa1.args: ' + s(psa1.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2348 cb.append('psa2.args: ' + s(psa2.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2349 cb.append('psa3.args: ' + s(psa3.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2350 cb.append('psa4.args: ' + s(psa4.args)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2351 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2352 cb.append('a.self: ' + s(a.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2353 cb.append('pa1.self: ' + s(pa1.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2354 cb.append('pa2.self: ' + s(pa2.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2355 cb.append('pa3.self: ' + s(pa3.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2356 cb.append('pa4.self: ' + s(pa4.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2357 cb.append('sa.self: ' + s(sa.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2358 cb.append('psa1.self: ' + s(psa1.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2359 cb.append('psa2.self: ' + s(psa2.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2360 cb.append('psa3.self: ' + s(psa3.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2361 cb.append('psa4.self: ' + s(psa4.self)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2362 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2363 cb.append('a.name: ' + s(a.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2364 cb.append('pa1.name: ' + s(pa1.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2365 cb.append('pa2.name: ' + s(pa2.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2366 cb.append('pa3.name: ' + s(pa3.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2367 cb.append('pa4.name: ' + s(pa4.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2368 cb.append('sa.name: ' + s(sa.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2369 cb.append('psa1.name: ' + s(psa1.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2370 cb.append('psa2.name: ' + s(psa2.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2371 cb.append('psa3.name: ' + s(psa3.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2372 cb.append('psa4.name: ' + s(psa4.name)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2373 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2374 cb.append('a.auto_rebind: ' + s(a.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2375 cb.append('pa1.auto_rebind: ' + s(pa1.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2376 cb.append('pa2.auto_rebind: ' + s(pa2.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2377 cb.append('pa3.auto_rebind: ' + s(pa3.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2378 cb.append('pa4.auto_rebind: ' + s(pa4.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2379 cb.append('sa.auto_rebind: ' + s(sa.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2380 cb.append('psa1.auto_rebind: ' + s(psa1.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2381 cb.append('psa2.auto_rebind: ' + s(psa2.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2382 cb.append('psa3.auto_rebind: ' + s(psa3.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2383 cb.append('psa4.auto_rebind: ' + s(psa4.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2384 cb.append('psa5.auto_rebind: ' + s(psa5.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2385 cb.append('psa6.auto_rebind: ' + s(psa6.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2386 cb.append('psa7.auto_rebind: ' + s(psa7.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2387 cb.append('psa8.auto_rebind: ' + s(psa8.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2388 cb.append('psa9.auto_rebind: ' + s(psa9.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2389 cb.append('psaA.auto_rebind: ' + s(psaA.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2390 cb.append('psaB.auto_rebind: ' + s(psaB.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2391 cb.append('psaC.auto_rebind: ' + s(psaC.auto_rebind)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2392 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2393 del s |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2394 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2395 del a |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2396 del pa1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2397 del pa2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2398 del pa3 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2399 del pa4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2400 del sa |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2401 del psa1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2402 del psa2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2403 del psa3 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2404 del psa4 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2405 del psa5 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2406 del psa6 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2407 del psa7 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2408 del psa8 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2409 del psa9 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2410 del psaA |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2411 del psaB |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2412 del psaC |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2413 del psar |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2414 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2415 del ecall |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2416 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2417 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2418 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2419 a(): !result: [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2420 pa1(): !result: ['abcArgsPA1'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2421 pa2(): !result: [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2422 pa3(): !result: ['abcArgsPA3'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2423 pa4(): !result: [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2424 sa(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2425 psa1(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2426 psa2(): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2427 psa3(): !result: [['abcArgsPSA3'], {'abcSelfPSA3': 'abcSelfPSA3Val'}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2428 psa4(): !result: [[], {'abcSelfPSA4': 'abcSelfPSA4Val'}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2429 a(42, 43): !result: [42, 43] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2430 pa1(42, 43): !result: ['abcArgsPA1', 42, 43] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2431 pa2(42, 43): !result: [42, 43] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2432 pa3(42, 43): !result: ['abcArgsPA3', 42, 43] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2433 pa4(42, 43): !result: [42, 43] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2434 sa(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2435 psa1(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2436 psa2(42, 43): !exception: error:('Vim:E725: Calling dict function without Dictionary: SelfArgs',) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2437 psa3(42, 43): !result: [['abcArgsPSA3', 42, 43], {'abcSelfPSA3': 'abcSelfPSA3Val'}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2438 psa4(42, 43): !result: [[42, 43], {'abcSelfPSA4': 'abcSelfPSA4Val'}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2439 a(42, self={"20": 1}): !result: [42] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2440 pa1(42, self={"20": 1}): !result: ['abcArgsPA1', 42] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2441 pa2(42, self={"20": 1}): !result: [42] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2442 pa3(42, self={"20": 1}): !result: ['abcArgsPA3', 42] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2443 pa4(42, self={"20": 1}): !result: [42] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2444 sa(42, self={"20": 1}): !result: [[42], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2445 psa1(42, self={"20": 1}): !result: [['abcArgsPSA1', 42], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2446 psa2(42, self={"20": 1}): !result: [[42], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2447 psa3(42, self={"20": 1}): !result: [['abcArgsPSA3', 42], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2448 psa4(42, self={"20": 1}): !result: [[42], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2449 a(self={"20": 1}): !result: [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2450 pa1(self={"20": 1}): !result: ['abcArgsPA1'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2451 pa2(self={"20": 1}): !result: [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2452 pa3(self={"20": 1}): !result: ['abcArgsPA3'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2453 pa4(self={"20": 1}): !result: [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2454 sa(self={"20": 1}): !result: [[], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2455 psa1(self={"20": 1}): !result: [['abcArgsPSA1'], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2456 psa2(self={"20": 1}): !result: [[], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2457 psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2458 psa4(self={"20": 1}): !result: [[], {'20': 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2459 a.args: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2460 pa1.args: ['abcArgsPA1'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2461 pa2.args: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2462 pa3.args: ['abcArgsPA3'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2463 pa4.args: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2464 sa.args: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2465 psa1.args: ['abcArgsPSA1'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2466 psa2.args: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2467 psa3.args: ['abcArgsPSA3'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2468 psa4.args: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2469 a.self: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2470 pa1.self: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2471 pa2.self: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2472 pa3.self: {'abcSelfPA3': 'abcSelfPA3Val'} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2473 pa4.self: {'abcSelfPA4': 'abcSelfPA4Val'} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2474 sa.self: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2475 psa1.self: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2476 psa2.self: None |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2477 psa3.self: {'abcSelfPSA3': 'abcSelfPSA3Val'} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2478 psa4.self: {'abcSelfPSA4': 'abcSelfPSA4Val'} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2479 a.name: 'Args' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2480 pa1.name: 'Args' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2481 pa2.name: 'Args' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2482 pa3.name: 'Args' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2483 pa4.name: 'Args' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2484 sa.name: 'SelfArgs' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2485 psa1.name: 'SelfArgs' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2486 psa2.name: 'SelfArgs' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2487 psa3.name: 'SelfArgs' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2488 psa4.name: 'SelfArgs' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2489 a.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2490 pa1.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2491 pa2.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2492 pa3.auto_rebind: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2493 pa4.auto_rebind: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2494 sa.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2495 psa1.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2496 psa2.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2497 psa3.auto_rebind: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2498 psa4.auto_rebind: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2499 psa5.auto_rebind: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2500 psa6.auto_rebind: 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2501 psa7.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2502 psa8.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2503 psa9.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2504 psaA.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2505 psaB.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2506 psaC.auto_rebind: 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2507 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2508 call assert_equal(expected, getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2509 %bw! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2510 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2511 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2512 " Test stdout/stderr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2513 func Test_python3_stdin_stderr() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2514 let caught_writeerr = 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2515 let caught_writelineerr = 0 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2516 redir => messages |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2517 py3 sys.stdout.write('abc8') ; sys.stdout.write('def') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2518 try |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2519 py3 sys.stderr.write('abc9') ; sys.stderr.write('def') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2520 catch /abc9def/ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2521 let caught_writeerr = 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2522 endtry |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2523 py3 sys.stdout.writelines(iter('abcA')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2524 try |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2525 py3 sys.stderr.writelines(iter('abcB')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2526 catch /abcB/ |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2527 let caught_writelineerr = 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2528 endtry |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2529 redir END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2530 call assert_equal("\nabc8def\nabcA", messages) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2531 call assert_equal(1, caught_writeerr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2532 call assert_equal(1, caught_writelineerr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2533 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2534 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2535 " Test subclassing |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2536 func Test_python3_subclass() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2537 new |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2538 func Put(...) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2539 return a:000 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2540 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2541 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2542 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2543 class DupDict(vim.Dictionary): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2544 def __setitem__(self, key, value): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2545 super(DupDict, self).__setitem__(key, value) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2546 super(DupDict, self).__setitem__('dup_' + key, value) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2547 dd = DupDict() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2548 dd['a'] = 'b' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2549 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2550 class DupList(vim.List): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2551 def __getitem__(self, idx): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2552 return [super(DupList, self).__getitem__(idx)] * 2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2553 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2554 dl = DupList() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2555 dl2 = DupList(iter('abcC')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2556 dl.extend(dl2[0]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2557 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2558 class DupFun(vim.Function): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2559 def __call__(self, arg): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2560 return super(DupFun, self).__call__(arg, arg) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2561 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2562 df = DupFun('Put') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2563 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2564 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2565 call assert_equal(['a', 'dup_a'], sort(keys(py3eval('dd')))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2566 call assert_equal(['a', 'a'], py3eval('dl')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2567 call assert_equal(['a', 'b', 'c', 'C'], py3eval('dl2')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2568 call assert_equal([2, 2], py3eval('df(2)')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2569 call assert_equal(1, py3eval('dl') is# py3eval('dl')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2570 call assert_equal(1, py3eval('dd') is# py3eval('dd')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2571 call assert_equal(function('Put'), py3eval('df')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2572 delfunction Put |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2573 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2574 del DupDict |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2575 del DupList |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2576 del DupFun |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2577 del dd |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2578 del dl |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2579 del dl2 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2580 del df |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2581 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2582 close! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2583 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2584 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2585 " Test chdir |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2586 func Test_python3_chdir() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2587 new Xfile |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2588 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2589 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2590 import os |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2591 fnamemodify = vim.Function('fnamemodify') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2592 cb.append(str(fnamemodify('.', ':p:h:t'))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2593 cb.append(vim.eval('@%')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2594 os.chdir('..') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2595 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:
21977
diff
changeset
|
2596 if path != b'src' and path != b'src2': |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2597 # Running tests from a shadow directory, so move up another level |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2598 # This will result in @% looking like shadow/testdir/Xfile, hence the |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2599 # slicing to remove the leading path and path separator |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2600 os.chdir('..') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2601 cb.append(str(fnamemodify('.', ':p:h:t'))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2602 cb.append(vim.eval('@%')[len(path)+1:].replace(os.path.sep, '/')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2603 os.chdir(path) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2604 else: |
22011
2b6d696b063d
patch 8.2.1555: not all tests are executed on Github Actions
Bram Moolenaar <Bram@vim.org>
parents:
21977
diff
changeset
|
2605 # 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:
21977
diff
changeset
|
2606 cb.append(str(fnamemodify('.', ':p:h:t').replace(b'src2', b'src'))) |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2607 cb.append(vim.eval('@%').replace(os.path.sep, '/')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2608 del path |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2609 os.chdir('testdir') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2610 cb.append(str(fnamemodify('.', ':p:h:t'))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2611 cb.append(vim.eval('@%')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2612 del fnamemodify |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2613 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2614 call assert_equal(["b'testdir'", 'Xfile', "b'src'", 'testdir/Xfile', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2615 \"b'testdir'", 'Xfile'], getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2616 close! |
21200
37edecbfb834
patch 8.2.1151: insufficient test coverage for Python
Bram Moolenaar <Bram@vim.org>
parents:
21198
diff
changeset
|
2617 call AssertException(["py3 vim.chdir(None)"], "Vim(py3):TypeError:") |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2618 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2619 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2620 " Test errors |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2621 func Test_python3_errors() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2622 func F() dict |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2623 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2624 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2625 func D() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2626 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2627 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2628 new |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2629 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2630 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2631 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2632 d = vim.Dictionary() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2633 ned = vim.Dictionary(foo='bar', baz='abcD') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2634 dl = vim.Dictionary(a=1) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2635 dl.locked = True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2636 l = vim.List() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2637 ll = vim.List('abcE') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2638 ll.locked = True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2639 nel = vim.List('abcO') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2640 f = vim.Function('string') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2641 fd = vim.Function('F') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2642 fdel = vim.Function('D') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2643 vim.command('delfunction D') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2644 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2645 def subexpr_test(expr, name, subexprs): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2646 cb.append('>>> Testing %s using %s' % (name, expr)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2647 for subexpr in subexprs: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2648 ee(expr % subexpr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2649 cb.append('<<< Finished') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2650 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2651 def stringtochars_test(expr): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2652 return subexpr_test(expr, 'StringToChars', ( |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2653 '1', # Fail type checks |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2654 'b"\\0"', # Fail PyString_AsStringAndSize(object, , NULL) check |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2655 '"\\0"', # Fail PyString_AsStringAndSize(bytes, , NULL) check |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2656 )) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2657 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2658 class Mapping(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2659 def __init__(self, d): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2660 self.d = d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2661 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2662 def __getitem__(self, key): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2663 return self.d[key] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2664 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2665 def keys(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2666 return self.d.keys() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2667 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2668 def items(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2669 return self.d.items() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2670 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2671 def convertfrompyobject_test(expr, recurse=True): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2672 # pydict_to_tv |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2673 stringtochars_test(expr % '{%s : 1}') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2674 if recurse: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2675 convertfrompyobject_test(expr % '{"abcF" : %s}', False) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2676 # pymap_to_tv |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2677 stringtochars_test(expr % 'Mapping({%s : 1})') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2678 if recurse: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2679 convertfrompyobject_test(expr % 'Mapping({"abcG" : %s})', False) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2680 # pyseq_to_tv |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2681 iter_test(expr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2682 return subexpr_test(expr, 'ConvertFromPyObject', ( |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2683 'None', # Not conversible |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2684 '{b"": 1}', # Empty key not allowed |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2685 '{"": 1}', # Same, but with unicode object |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2686 'FailingMapping()', # |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2687 'FailingMappingKey()', # |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2688 'FailingNumber()', # |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2689 )) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2690 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2691 def convertfrompymapping_test(expr): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2692 convertfrompyobject_test(expr) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2693 return subexpr_test(expr, 'ConvertFromPyMapping', ( |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2694 '[]', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2695 )) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2696 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2697 def iter_test(expr): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2698 return subexpr_test(expr, '*Iter*', ( |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2699 'FailingIter()', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2700 'FailingIterNext()', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2701 )) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2702 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2703 def number_test(expr, natural=False, unsigned=False): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2704 if natural: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2705 unsigned = True |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2706 return subexpr_test(expr, 'NumberToLong', ( |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2707 '[]', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2708 'None', |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2709 ) + (('-1',) if unsigned else ()) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2710 + (('0',) if natural else ())) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2711 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2712 class FailingTrue(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2713 def __bool__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2714 raise NotImplementedError('bool') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2715 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2716 class FailingIter(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2717 def __iter__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2718 raise NotImplementedError('iter') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2719 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2720 class FailingIterNext(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2721 def __iter__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2722 return self |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2723 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2724 def __next__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2725 raise NotImplementedError('next') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2726 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2727 class FailingIterNextN(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2728 def __init__(self, n): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2729 self.n = n |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2730 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2731 def __iter__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2732 return self |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2733 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2734 def __next__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2735 if self.n: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2736 self.n -= 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2737 return 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2738 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2739 raise NotImplementedError('next N') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2740 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2741 class FailingMappingKey(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2742 def __getitem__(self, item): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2743 raise NotImplementedError('getitem:mappingkey') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2744 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2745 def keys(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2746 return list("abcH") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2747 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2748 class FailingMapping(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2749 def __getitem__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2750 raise NotImplementedError('getitem:mapping') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2751 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2752 def keys(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2753 raise NotImplementedError('keys') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2754 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2755 class FailingList(list): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2756 def __getitem__(self, idx): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2757 if i == 2: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2758 raise NotImplementedError('getitem:list') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2759 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2760 return super(FailingList, self).__getitem__(idx) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2761 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2762 class NoArgsCall(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2763 def __call__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2764 pass |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2765 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2766 class FailingCall(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2767 def __call__(self, path): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2768 raise NotImplementedError('call') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2769 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2770 class FailingNumber(object): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2771 def __int__(self): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2772 raise NotImplementedError('int') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2773 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2774 cb.append("> Output") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2775 cb.append(">> OutputSetattr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2776 ee('del sys.stdout.softspace') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2777 number_test('sys.stdout.softspace = %s', unsigned=True) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2778 number_test('sys.stderr.softspace = %s', unsigned=True) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2779 ee('assert sys.stdout.isatty()==False') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2780 ee('assert sys.stdout.seekable()==False') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2781 ee('sys.stdout.close()') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2782 ee('sys.stdout.flush()') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2783 ee('assert sys.stderr.isatty()==False') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2784 ee('assert sys.stderr.seekable()==False') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2785 ee('sys.stderr.close()') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2786 ee('sys.stderr.flush()') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2787 ee('sys.stdout.attr = None') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2788 cb.append(">> OutputWrite") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2789 ee('assert sys.stdout.writable()==True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2790 ee('assert sys.stdout.readable()==False') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2791 ee('assert sys.stderr.writable()==True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2792 ee('assert sys.stderr.readable()==False') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2793 ee('assert sys.stdout.closed()==False') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2794 ee('assert sys.stderr.closed()==False') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2795 ee('assert sys.stdout.errors=="strict"') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2796 ee('assert sys.stderr.errors=="strict"') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2797 ee('assert sys.stdout.encoding==sys.stderr.encoding') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2798 ee('sys.stdout.write(None)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2799 cb.append(">> OutputWriteLines") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2800 ee('sys.stdout.writelines(None)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2801 ee('sys.stdout.writelines([1])') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2802 iter_test('sys.stdout.writelines(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2803 cb.append("> VimCommand") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2804 stringtochars_test('vim.command(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2805 ee('vim.command("", 2)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2806 #! Not checked: vim->python exceptions translating: checked later |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2807 cb.append("> VimToPython") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2808 #! Not checked: everything: needs errors in internal python functions |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2809 cb.append("> VimEval") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2810 stringtochars_test('vim.eval(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2811 ee('vim.eval("", FailingTrue())') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2812 #! Not checked: everything: needs errors in internal python functions |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2813 cb.append("> VimEvalPy") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2814 stringtochars_test('vim.bindeval(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2815 ee('vim.eval("", 2)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2816 #! Not checked: vim->python exceptions translating: checked later |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2817 cb.append("> VimStrwidth") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2818 stringtochars_test('vim.strwidth(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2819 cb.append("> VimForeachRTP") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2820 ee('vim.foreach_rtp(None)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2821 ee('vim.foreach_rtp(NoArgsCall())') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2822 ee('vim.foreach_rtp(FailingCall())') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2823 ee('vim.foreach_rtp(int, 2)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2824 cb.append('> import') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2825 old_rtp = vim.options['rtp'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2826 vim.options['rtp'] = os.getcwd().replace('\\', '\\\\').replace(',', '\\,') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2827 ee('import xxx_no_such_module_xxx') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2828 ee('import failing_import') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2829 ee('import failing') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2830 vim.options['rtp'] = old_rtp |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2831 del old_rtp |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2832 cb.append("> Options") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2833 cb.append(">> OptionsItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2834 ee('vim.options["abcQ"]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2835 ee('vim.options[""]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2836 stringtochars_test('vim.options[%s]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2837 cb.append(">> OptionsContains") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2838 stringtochars_test('%s in vim.options') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2839 cb.append("> Dictionary") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2840 cb.append(">> DictionaryConstructor") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2841 ee('vim.Dictionary("abcI")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2842 ##! Not checked: py_dict_alloc failure |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2843 cb.append(">> DictionarySetattr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2844 ee('del d.locked') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2845 ee('d.locked = FailingTrue()') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2846 ee('vim.vvars.locked = False') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2847 ee('d.scope = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2848 ee('d.xxx = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2849 cb.append(">> _DictionaryItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2850 ee('d.get("a", 2, 3)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2851 stringtochars_test('d.get(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2852 ee('d.pop("a")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2853 ee('dl.pop("a")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2854 cb.append(">> DictionaryContains") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2855 ee('"" in d') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2856 ee('0 in d') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2857 cb.append(">> DictionaryIterNext") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2858 ee('for i in ned: ned["a"] = 1') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2859 del i |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2860 cb.append(">> DictionaryAssItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2861 ee('dl["b"] = 1') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2862 stringtochars_test('d[%s] = 1') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2863 convertfrompyobject_test('d["a"] = %s') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2864 cb.append(">> DictionaryUpdate") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2865 cb.append(">>> kwargs") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2866 cb.append(">>> iter") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2867 ee('d.update(FailingMapping())') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2868 ee('d.update([FailingIterNext()])') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2869 ee('d.update([FailingIterNextN(1)])') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2870 iter_test('d.update(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2871 convertfrompyobject_test('d.update(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2872 stringtochars_test('d.update(((%s, 0),))') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2873 convertfrompyobject_test('d.update((("a", %s),))') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2874 cb.append(">> DictionaryPopItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2875 ee('d.popitem(1, 2)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2876 cb.append(">> DictionaryHasKey") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2877 ee('d.has_key()') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2878 cb.append("> List") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2879 cb.append(">> ListConstructor") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2880 ee('vim.List(1, 2)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2881 ee('vim.List(a=1)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2882 iter_test('vim.List(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2883 convertfrompyobject_test('vim.List([%s])') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2884 cb.append(">> ListItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2885 ee('l[1000]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2886 cb.append(">> ListAssItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2887 ee('ll[1] = 2') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2888 ee('l[1000] = 3') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2889 cb.append(">> ListAssSlice") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2890 ee('ll[1:100] = "abcJ"') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2891 iter_test('l[:] = %s') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2892 ee('nel[1:10:2] = "abcK"') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2893 cb.append(repr(tuple(nel))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2894 ee('nel[1:10:2] = "a"') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2895 cb.append(repr(tuple(nel))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2896 ee('nel[1:1:-1] = "a"') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2897 cb.append(repr(tuple(nel))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2898 ee('nel[:] = FailingIterNextN(2)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2899 cb.append(repr(tuple(nel))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2900 convertfrompyobject_test('l[:] = [%s]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2901 cb.append(">> ListConcatInPlace") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2902 iter_test('l.extend(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2903 convertfrompyobject_test('l.extend([%s])') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2904 cb.append(">> ListSetattr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2905 ee('del l.locked') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2906 ee('l.locked = FailingTrue()') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2907 ee('l.xxx = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2908 cb.append("> Function") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2909 cb.append(">> FunctionConstructor") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2910 cb.append(">>> FunctionConstructor") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2911 ee('vim.Function("123")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2912 ee('vim.Function("xxx_non_existent_function_xxx")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2913 ee('vim.Function("xxx#non#existent#function#xxx")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2914 ee('vim.Function("xxx_non_existent_function_xxx2", args=[])') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2915 ee('vim.Function("xxx_non_existent_function_xxx3", self={})') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2916 ee('vim.Function("xxx_non_existent_function_xxx4", args=[], self={})') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2917 cb.append(">>> FunctionNew") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2918 ee('vim.Function("tr", self="abcFuncSelf")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2919 ee('vim.Function("tr", args=427423)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2920 ee('vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2921 ee('vim.Function(self="abcFuncSelf2", args="abcFuncArgs2")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2922 ee('vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2923 ee('vim.Function("tr", "")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2924 cb.append(">> FunctionCall") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2925 convertfrompyobject_test('f(%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2926 convertfrompymapping_test('fd(self=%s)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2927 cb.append("> TabPage") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2928 cb.append(">> TabPageAttr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2929 ee('vim.current.tabpage.xxx') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2930 cb.append("> TabList") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2931 cb.append(">> TabListItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2932 ee('vim.tabpages[1000]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2933 cb.append("> Window") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2934 cb.append(">> WindowAttr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2935 ee('vim.current.window.xxx') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2936 cb.append(">> WindowSetattr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2937 ee('vim.current.window.buffer = 0') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2938 ee('vim.current.window.cursor = (100000000, 100000000)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2939 ee('vim.current.window.cursor = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2940 number_test('vim.current.window.height = %s', unsigned=True) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2941 number_test('vim.current.window.width = %s', unsigned=True) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2942 ee('vim.current.window.xxxxxx = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2943 cb.append("> WinList") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2944 cb.append(">> WinListItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2945 ee('vim.windows[1000]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2946 cb.append("> Buffer") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2947 cb.append(">> StringToLine (indirect)") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2948 ee('vim.current.buffer[0] = "\\na"') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2949 ee('vim.current.buffer[0] = b"\\na"') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2950 cb.append(">> SetBufferLine (indirect)") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2951 ee('vim.current.buffer[0] = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2952 cb.append(">> SetBufferLineList (indirect)") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2953 ee('vim.current.buffer[:] = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2954 ee('vim.current.buffer[:] = ["\\na", "bc"]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2955 cb.append(">> InsertBufferLines (indirect)") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2956 ee('vim.current.buffer.append(None)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2957 ee('vim.current.buffer.append(["\\na", "bc"])') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2958 ee('vim.current.buffer.append("\\nbc")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2959 cb.append(">> RBItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2960 ee('vim.current.buffer[100000000]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2961 cb.append(">> RBAsItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2962 ee('vim.current.buffer[100000000] = ""') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2963 cb.append(">> BufferAttr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2964 ee('vim.current.buffer.xxx') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2965 cb.append(">> BufferSetattr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2966 ee('vim.current.buffer.name = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2967 ee('vim.current.buffer.xxx = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2968 cb.append(">> BufferMark") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2969 ee('vim.current.buffer.mark(0)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2970 ee('vim.current.buffer.mark("abcM")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2971 ee('vim.current.buffer.mark("!")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2972 cb.append(">> BufferRange") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2973 ee('vim.current.buffer.range(1, 2, 3)') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2974 cb.append("> BufMap") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2975 cb.append(">> BufMapItem") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2976 ee('vim.buffers[100000000]') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2977 number_test('vim.buffers[%s]', natural=True) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2978 cb.append("> Current") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2979 cb.append(">> CurrentGetattr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2980 ee('vim.current.xxx') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2981 cb.append(">> CurrentSetattr") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2982 ee('vim.current.line = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2983 ee('vim.current.buffer = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2984 ee('vim.current.window = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2985 ee('vim.current.tabpage = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2986 ee('vim.current.xxx = True') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2987 del d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2988 del ned |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2989 del dl |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2990 del l |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2991 del ll |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2992 del nel |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2993 del f |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2994 del fd |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2995 del fdel |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2996 del subexpr_test |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2997 del stringtochars_test |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2998 del Mapping |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
2999 del convertfrompyobject_test |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3000 del convertfrompymapping_test |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3001 del iter_test |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3002 del number_test |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3003 del FailingTrue |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3004 del FailingIter |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3005 del FailingIterNext |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3006 del FailingIterNextN |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3007 del FailingMapping |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3008 del FailingMappingKey |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3009 del FailingList |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3010 del NoArgsCall |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3011 del FailingCall |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3012 del FailingNumber |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3013 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3014 delfunction F |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3015 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3016 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3017 > Output |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3018 >> OutputSetattr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3019 del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError('cannot delete OutputObject attributes',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3020 >>> Testing NumberToLong using sys.stdout.softspace = %s |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3021 sys.stdout.softspace = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3022 sys.stdout.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3023 sys.stdout.softspace = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3024 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3025 >>> Testing NumberToLong using sys.stderr.softspace = %s |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3026 sys.stderr.softspace = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3027 sys.stderr.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3028 sys.stderr.softspace = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3029 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3030 assert sys.stdout.isatty()==False:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3031 assert sys.stdout.seekable()==False:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3032 sys.stdout.close():NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3033 sys.stdout.flush():NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3034 assert sys.stderr.isatty()==False:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3035 assert sys.stderr.seekable()==False:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3036 sys.stderr.close():NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3037 sys.stderr.flush():NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3038 sys.stdout.attr = None:(<class 'AttributeError'>, AttributeError('invalid attribute: attr',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3039 >> OutputWrite |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3040 assert sys.stdout.writable()==True:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3041 assert sys.stdout.readable()==False:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3042 assert sys.stderr.writable()==True:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3043 assert sys.stderr.readable()==False:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3044 assert sys.stdout.closed()==False:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3045 assert sys.stderr.closed()==False:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3046 assert sys.stdout.errors=="strict":NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3047 assert sys.stderr.errors=="strict":NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3048 assert sys.stdout.encoding==sys.stderr.encoding:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3049 sys.stdout.write(None):(<class 'TypeError'>, TypeError("Can't convert 'NoneType' object to str implicitly",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3050 >> OutputWriteLines |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3051 sys.stdout.writelines(None):(<class 'TypeError'>, TypeError("'NoneType' object is not iterable",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3052 sys.stdout.writelines([1]):(<class 'TypeError'>, TypeError("Can't convert 'int' object to str implicitly",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3053 >>> Testing *Iter* using sys.stdout.writelines(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3054 sys.stdout.writelines(FailingIter()):(<class 'NotImplementedError'>, NotImplementedError('iter',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3055 sys.stdout.writelines(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3056 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3057 > VimCommand |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3058 >>> Testing StringToChars using vim.command(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3059 vim.command(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3060 vim.command(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3061 vim.command("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3062 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3063 vim.command("", 2):(<class 'TypeError'>, TypeError('command() takes exactly one argument (2 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3064 > VimToPython |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3065 > VimEval |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3066 >>> Testing StringToChars using vim.eval(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3067 vim.eval(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3068 vim.eval(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3069 vim.eval("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3070 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3071 vim.eval("", FailingTrue()):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3072 > VimEvalPy |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3073 >>> Testing StringToChars using vim.bindeval(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3074 vim.bindeval(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3075 vim.bindeval(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3076 vim.bindeval("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3077 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3078 vim.eval("", 2):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3079 > VimStrwidth |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3080 >>> Testing StringToChars using vim.strwidth(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3081 vim.strwidth(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3082 vim.strwidth(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3083 vim.strwidth("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3084 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3085 > VimForeachRTP |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3086 vim.foreach_rtp(None):(<class 'TypeError'>, TypeError("'NoneType' object is not callable",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3087 vim.foreach_rtp(NoArgsCall()):(<class 'TypeError'>, TypeError('__call__() takes exactly 1 positional argument (2 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3088 vim.foreach_rtp(FailingCall()):(<class 'NotImplementedError'>, NotImplementedError('call',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3089 vim.foreach_rtp(int, 2):(<class 'TypeError'>, TypeError('foreach_rtp() takes exactly one argument (2 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3090 > import |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3091 import xxx_no_such_module_xxx:(<class 'ImportError'>, ImportError('No module named xxx_no_such_module_xxx',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3092 import failing_import:(<class 'ImportError'>, ImportError()) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3093 import failing:(<class 'NotImplementedError'>, NotImplementedError()) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3094 > Options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3095 >> OptionsItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3096 vim.options["abcQ"]:(<class 'KeyError'>, KeyError('abcQ',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3097 vim.options[""]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3098 >>> Testing StringToChars using vim.options[%s] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3099 vim.options[1]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3100 vim.options[b"\0"]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3101 vim.options["\0"]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3102 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3103 >> OptionsContains |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3104 >>> Testing StringToChars using %s in vim.options |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3105 1 in vim.options:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3106 b"\0" in vim.options:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3107 "\0" in vim.options:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3108 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3109 > Dictionary |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3110 >> DictionaryConstructor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3111 vim.Dictionary("abcI"):(<class 'ValueError'>, ValueError('expected sequence element of size 2, but got sequence of size 1',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3112 >> DictionarySetattr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3113 del d.locked:(<class 'AttributeError'>, AttributeError('cannot delete vim.Dictionary attributes',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3114 d.locked = FailingTrue():(<class 'NotImplementedError'>, NotImplementedError('bool',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3115 vim.vvars.locked = False:(<class 'TypeError'>, TypeError('cannot modify fixed dictionary',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3116 d.scope = True:(<class 'AttributeError'>, AttributeError('cannot set attribute scope',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3117 d.xxx = True:(<class 'AttributeError'>, AttributeError('cannot set attribute xxx',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3118 >> _DictionaryItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3119 d.get("a", 2, 3):(<class 'TypeError'>, TypeError('function takes at most 2 arguments (3 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3120 >>> Testing StringToChars using d.get(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3121 d.get(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3122 d.get(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3123 d.get("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3124 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3125 d.pop("a"):(<class 'KeyError'>, KeyError('a',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3126 dl.pop("a"):(<class 'vim.error'>, error('dictionary is locked',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3127 >> DictionaryContains |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3128 "" in d:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3129 0 in d:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3130 >> DictionaryIterNext |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3131 for i in ned: ned["a"] = 1:(<class 'RuntimeError'>, RuntimeError('hashtab changed during iteration',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3132 >> DictionaryAssItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3133 dl["b"] = 1:(<class 'vim.error'>, error('dictionary is locked',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3134 >>> Testing StringToChars using d[%s] = 1 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3135 d[1] = 1:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3136 d[b"\0"] = 1:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3137 d["\0"] = 1:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3138 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3139 >>> Testing StringToChars using d["a"] = {%s : 1} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3140 d["a"] = {1 : 1}:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3141 d["a"] = {b"\0" : 1}:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3142 d["a"] = {"\0" : 1}:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3143 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3144 >>> Testing StringToChars using d["a"] = {"abcF" : {%s : 1}} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3145 d["a"] = {"abcF" : {1 : 1}}:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3146 d["a"] = {"abcF" : {b"\0" : 1}}:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3147 d["a"] = {"abcF" : {"\0" : 1}}:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3148 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3149 >>> Testing StringToChars using d["a"] = {"abcF" : Mapping({%s : 1})} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3150 d["a"] = {"abcF" : Mapping({1 : 1})}:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3151 d["a"] = {"abcF" : Mapping({b"\0" : 1})}:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3152 d["a"] = {"abcF" : Mapping({"\0" : 1})}:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3153 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3154 >>> Testing *Iter* using d["a"] = {"abcF" : %s} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3155 d["a"] = {"abcF" : FailingIter()}:(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3156 d["a"] = {"abcF" : FailingIterNext()}:(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3157 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3158 >>> Testing ConvertFromPyObject using d["a"] = {"abcF" : %s} |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3159 d["a"] = {"abcF" : None}:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3160 d["a"] = {"abcF" : {b"": 1}}:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3161 d["a"] = {"abcF" : {"": 1}}:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3162 d["a"] = {"abcF" : FailingMapping()}:(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3163 d["a"] = {"abcF" : FailingMappingKey()}:(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3164 d["a"] = {"abcF" : FailingNumber()}:(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3165 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3166 >>> Testing StringToChars using d["a"] = Mapping({%s : 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3167 d["a"] = Mapping({1 : 1}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3168 d["a"] = Mapping({b"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3169 d["a"] = Mapping({"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3170 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3171 >>> Testing StringToChars using d["a"] = Mapping({"abcG" : {%s : 1}}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3172 d["a"] = Mapping({"abcG" : {1 : 1}}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3173 d["a"] = Mapping({"abcG" : {b"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3174 d["a"] = Mapping({"abcG" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3175 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3176 >>> Testing StringToChars using d["a"] = Mapping({"abcG" : Mapping({%s : 1})}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3177 d["a"] = Mapping({"abcG" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3178 d["a"] = Mapping({"abcG" : Mapping({b"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3179 d["a"] = Mapping({"abcG" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3180 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3181 >>> Testing *Iter* using d["a"] = Mapping({"abcG" : %s}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3182 d["a"] = Mapping({"abcG" : FailingIter()}):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3183 d["a"] = Mapping({"abcG" : FailingIterNext()}):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3184 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3185 >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abcG" : %s}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3186 d["a"] = Mapping({"abcG" : None}):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3187 d["a"] = Mapping({"abcG" : {b"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3188 d["a"] = Mapping({"abcG" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3189 d["a"] = Mapping({"abcG" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3190 d["a"] = Mapping({"abcG" : FailingMappingKey()}):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3191 d["a"] = Mapping({"abcG" : FailingNumber()}):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3192 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3193 >>> Testing *Iter* using d["a"] = %s |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3194 d["a"] = FailingIter():(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3195 d["a"] = FailingIterNext():(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3196 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3197 >>> Testing ConvertFromPyObject using d["a"] = %s |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3198 d["a"] = None:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3199 d["a"] = {b"": 1}:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3200 d["a"] = {"": 1}:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3201 d["a"] = FailingMapping():(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3202 d["a"] = FailingMappingKey():(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3203 d["a"] = FailingNumber():(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3204 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3205 >> DictionaryUpdate |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3206 >>> kwargs |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3207 >>> iter |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3208 d.update(FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3209 d.update([FailingIterNext()]):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3210 d.update([FailingIterNextN(1)]):(<class 'NotImplementedError'>, NotImplementedError('next N',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3211 >>> Testing *Iter* using d.update(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3212 d.update(FailingIter()):(<class 'NotImplementedError'>, NotImplementedError('iter',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3213 d.update(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3214 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3215 >>> Testing StringToChars using d.update({%s : 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3216 d.update({1 : 1}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3217 d.update({b"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3218 d.update({"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3219 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3220 >>> Testing StringToChars using d.update({"abcF" : {%s : 1}}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3221 d.update({"abcF" : {1 : 1}}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3222 d.update({"abcF" : {b"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3223 d.update({"abcF" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3224 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3225 >>> Testing StringToChars using d.update({"abcF" : Mapping({%s : 1})}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3226 d.update({"abcF" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3227 d.update({"abcF" : Mapping({b"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3228 d.update({"abcF" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3229 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3230 >>> Testing *Iter* using d.update({"abcF" : %s}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3231 d.update({"abcF" : FailingIter()}):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3232 d.update({"abcF" : FailingIterNext()}):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3233 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3234 >>> Testing ConvertFromPyObject using d.update({"abcF" : %s}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3235 d.update({"abcF" : None}):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3236 d.update({"abcF" : {b"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3237 d.update({"abcF" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3238 d.update({"abcF" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3239 d.update({"abcF" : FailingMappingKey()}):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3240 d.update({"abcF" : FailingNumber()}):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3241 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3242 >>> Testing StringToChars using d.update(Mapping({%s : 1})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3243 d.update(Mapping({1 : 1})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3244 d.update(Mapping({b"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3245 d.update(Mapping({"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3246 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3247 >>> Testing StringToChars using d.update(Mapping({"abcG" : {%s : 1}})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3248 d.update(Mapping({"abcG" : {1 : 1}})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3249 d.update(Mapping({"abcG" : {b"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3250 d.update(Mapping({"abcG" : {"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3251 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3252 >>> Testing StringToChars using d.update(Mapping({"abcG" : Mapping({%s : 1})})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3253 d.update(Mapping({"abcG" : Mapping({1 : 1})})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3254 d.update(Mapping({"abcG" : Mapping({b"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3255 d.update(Mapping({"abcG" : Mapping({"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3256 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3257 >>> Testing *Iter* using d.update(Mapping({"abcG" : %s})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3258 d.update(Mapping({"abcG" : FailingIter()})):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3259 d.update(Mapping({"abcG" : FailingIterNext()})):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3260 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3261 >>> Testing ConvertFromPyObject using d.update(Mapping({"abcG" : %s})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3262 d.update(Mapping({"abcG" : None})):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3263 d.update(Mapping({"abcG" : {b"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3264 d.update(Mapping({"abcG" : {"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3265 d.update(Mapping({"abcG" : FailingMapping()})):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3266 d.update(Mapping({"abcG" : FailingMappingKey()})):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3267 d.update(Mapping({"abcG" : FailingNumber()})):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3268 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3269 >>> Testing *Iter* using d.update(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3270 d.update(FailingIter()):(<class 'NotImplementedError'>, NotImplementedError('iter',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3271 d.update(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3272 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3273 >>> Testing ConvertFromPyObject using d.update(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3274 d.update(None):(<class 'TypeError'>, TypeError("'NoneType' object is not iterable",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3275 d.update({b"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3276 d.update({"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3277 d.update(FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3278 d.update(FailingMappingKey()):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3279 d.update(FailingNumber()):(<class 'TypeError'>, TypeError("'FailingNumber' object is not iterable",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3280 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3281 >>> Testing StringToChars using d.update(((%s, 0),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3282 d.update(((1, 0),)):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3283 d.update(((b"\0", 0),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3284 d.update((("\0", 0),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3285 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3286 >>> Testing StringToChars using d.update((("a", {%s : 1}),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3287 d.update((("a", {1 : 1}),)):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3288 d.update((("a", {b"\0" : 1}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3289 d.update((("a", {"\0" : 1}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3290 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3291 >>> Testing StringToChars using d.update((("a", {"abcF" : {%s : 1}}),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3292 d.update((("a", {"abcF" : {1 : 1}}),)):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3293 d.update((("a", {"abcF" : {b"\0" : 1}}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3294 d.update((("a", {"abcF" : {"\0" : 1}}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3295 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3296 >>> Testing StringToChars using d.update((("a", {"abcF" : Mapping({%s : 1})}),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3297 d.update((("a", {"abcF" : Mapping({1 : 1})}),)):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3298 d.update((("a", {"abcF" : Mapping({b"\0" : 1})}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3299 d.update((("a", {"abcF" : Mapping({"\0" : 1})}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3300 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3301 >>> Testing *Iter* using d.update((("a", {"abcF" : %s}),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3302 d.update((("a", {"abcF" : FailingIter()}),)):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3303 d.update((("a", {"abcF" : FailingIterNext()}),)):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3304 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3305 >>> Testing ConvertFromPyObject using d.update((("a", {"abcF" : %s}),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3306 d.update((("a", {"abcF" : None}),)):(<class 'vim.error'>, error("failed to add key 'a' to dictionary",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3307 d.update((("a", {"abcF" : {b"": 1}}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3308 d.update((("a", {"abcF" : {"": 1}}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3309 d.update((("a", {"abcF" : FailingMapping()}),)):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3310 d.update((("a", {"abcF" : FailingMappingKey()}),)):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3311 d.update((("a", {"abcF" : FailingNumber()}),)):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3312 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3313 >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3314 d.update((("a", Mapping({1 : 1})),)):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3315 d.update((("a", Mapping({b"\0" : 1})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3316 d.update((("a", Mapping({"\0" : 1})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3317 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3318 >>> Testing StringToChars using d.update((("a", Mapping({"abcG" : {%s : 1}})),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3319 d.update((("a", Mapping({"abcG" : {1 : 1}})),)):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3320 d.update((("a", Mapping({"abcG" : {b"\0" : 1}})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3321 d.update((("a", Mapping({"abcG" : {"\0" : 1}})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3322 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3323 >>> Testing StringToChars using d.update((("a", Mapping({"abcG" : Mapping({%s : 1})})),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3324 d.update((("a", Mapping({"abcG" : Mapping({1 : 1})})),)):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3325 d.update((("a", Mapping({"abcG" : Mapping({b"\0" : 1})})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3326 d.update((("a", Mapping({"abcG" : Mapping({"\0" : 1})})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3327 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3328 >>> Testing *Iter* using d.update((("a", Mapping({"abcG" : %s})),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3329 d.update((("a", Mapping({"abcG" : FailingIter()})),)):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3330 d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3331 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3332 >>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abcG" : %s})),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3333 d.update((("a", Mapping({"abcG" : None})),)):(<class 'vim.error'>, error("failed to add key 'a' to dictionary",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3334 d.update((("a", Mapping({"abcG" : {b"": 1}})),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3335 d.update((("a", Mapping({"abcG" : {"": 1}})),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3336 d.update((("a", Mapping({"abcG" : FailingMapping()})),)):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3337 d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3338 d.update((("a", Mapping({"abcG" : FailingNumber()})),)):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3339 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3340 >>> Testing *Iter* using d.update((("a", %s),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3341 d.update((("a", FailingIter()),)):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3342 d.update((("a", FailingIterNext()),)):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3343 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3344 >>> Testing ConvertFromPyObject using d.update((("a", %s),)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3345 d.update((("a", None),)):(<class 'vim.error'>, error("failed to add key 'a' to dictionary",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3346 d.update((("a", {b"": 1}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3347 d.update((("a", {"": 1}),)):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3348 d.update((("a", FailingMapping()),)):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3349 d.update((("a", FailingMappingKey()),)):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3350 d.update((("a", FailingNumber()),)):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3351 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3352 >> DictionaryPopItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3353 d.popitem(1, 2):(<class 'TypeError'>, TypeError('popitem() takes no arguments (2 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3354 >> DictionaryHasKey |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3355 d.has_key():(<class 'TypeError'>, TypeError('has_key() takes exactly one argument (0 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3356 > List |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3357 >> ListConstructor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3358 vim.List(1, 2):(<class 'TypeError'>, TypeError('function takes at most 1 argument (2 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3359 vim.List(a=1):(<class 'TypeError'>, TypeError('list constructor does not accept keyword arguments',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3360 >>> Testing *Iter* using vim.List(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3361 vim.List(FailingIter()):(<class 'NotImplementedError'>, NotImplementedError('iter',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3362 vim.List(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3363 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3364 >>> Testing StringToChars using vim.List([{%s : 1}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3365 vim.List([{1 : 1}]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3366 vim.List([{b"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3367 vim.List([{"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3368 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3369 >>> Testing StringToChars using vim.List([{"abcF" : {%s : 1}}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3370 vim.List([{"abcF" : {1 : 1}}]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3371 vim.List([{"abcF" : {b"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3372 vim.List([{"abcF" : {"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3373 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3374 >>> Testing StringToChars using vim.List([{"abcF" : Mapping({%s : 1})}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3375 vim.List([{"abcF" : Mapping({1 : 1})}]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3376 vim.List([{"abcF" : Mapping({b"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3377 vim.List([{"abcF" : Mapping({"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3378 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3379 >>> Testing *Iter* using vim.List([{"abcF" : %s}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3380 vim.List([{"abcF" : FailingIter()}]):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3381 vim.List([{"abcF" : FailingIterNext()}]):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3382 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3383 >>> Testing ConvertFromPyObject using vim.List([{"abcF" : %s}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3384 vim.List([{"abcF" : None}]):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3385 vim.List([{"abcF" : {b"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3386 vim.List([{"abcF" : {"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3387 vim.List([{"abcF" : FailingMapping()}]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3388 vim.List([{"abcF" : FailingMappingKey()}]):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3389 vim.List([{"abcF" : FailingNumber()}]):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3390 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3391 >>> Testing StringToChars using vim.List([Mapping({%s : 1})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3392 vim.List([Mapping({1 : 1})]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3393 vim.List([Mapping({b"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3394 vim.List([Mapping({"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3395 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3396 >>> Testing StringToChars using vim.List([Mapping({"abcG" : {%s : 1}})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3397 vim.List([Mapping({"abcG" : {1 : 1}})]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3398 vim.List([Mapping({"abcG" : {b"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3399 vim.List([Mapping({"abcG" : {"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3400 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3401 >>> Testing StringToChars using vim.List([Mapping({"abcG" : Mapping({%s : 1})})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3402 vim.List([Mapping({"abcG" : Mapping({1 : 1})})]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3403 vim.List([Mapping({"abcG" : Mapping({b"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3404 vim.List([Mapping({"abcG" : Mapping({"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3405 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3406 >>> Testing *Iter* using vim.List([Mapping({"abcG" : %s})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3407 vim.List([Mapping({"abcG" : FailingIter()})]):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3408 vim.List([Mapping({"abcG" : FailingIterNext()})]):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3409 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3410 >>> Testing ConvertFromPyObject using vim.List([Mapping({"abcG" : %s})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3411 vim.List([Mapping({"abcG" : None})]):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3412 vim.List([Mapping({"abcG" : {b"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3413 vim.List([Mapping({"abcG" : {"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3414 vim.List([Mapping({"abcG" : FailingMapping()})]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3415 vim.List([Mapping({"abcG" : FailingMappingKey()})]):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3416 vim.List([Mapping({"abcG" : FailingNumber()})]):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3417 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3418 >>> Testing *Iter* using vim.List([%s]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3419 vim.List([FailingIter()]):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3420 vim.List([FailingIterNext()]):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3421 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3422 >>> Testing ConvertFromPyObject using vim.List([%s]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3423 vim.List([None]):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3424 vim.List([{b"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3425 vim.List([{"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3426 vim.List([FailingMapping()]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3427 vim.List([FailingMappingKey()]):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3428 vim.List([FailingNumber()]):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3429 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3430 >> ListItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3431 l[1000]:(<class 'IndexError'>, IndexError('list index out of range',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3432 >> ListAssItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3433 ll[1] = 2:(<class 'vim.error'>, error('list is locked',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3434 l[1000] = 3:(<class 'IndexError'>, IndexError('list index out of range',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3435 >> ListAssSlice |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3436 ll[1:100] = "abcJ":(<class 'vim.error'>, error('list is locked',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3437 >>> Testing *Iter* using l[:] = %s |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3438 l[:] = FailingIter():(<class 'NotImplementedError'>, NotImplementedError('iter',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3439 l[:] = FailingIterNext():(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3440 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3441 nel[1:10:2] = "abcK":(<class 'ValueError'>, ValueError('attempt to assign sequence of size greater than 2 to extended slice',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3442 (b'a', b'b', b'c', b'O') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3443 nel[1:10:2] = "a":(<class 'ValueError'>, ValueError('attempt to assign sequence of size 1 to extended slice of size 2',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3444 (b'a', b'b', b'c', b'O') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3445 nel[1:1:-1] = "a":(<class 'ValueError'>, ValueError('attempt to assign sequence of size greater than 0 to extended slice',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3446 (b'a', b'b', b'c', b'O') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3447 nel[:] = FailingIterNextN(2):(<class 'NotImplementedError'>, NotImplementedError('next N',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3448 (b'a', b'b', b'c', b'O') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3449 >>> Testing StringToChars using l[:] = [{%s : 1}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3450 l[:] = [{1 : 1}]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3451 l[:] = [{b"\0" : 1}]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3452 l[:] = [{"\0" : 1}]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3453 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3454 >>> Testing StringToChars using l[:] = [{"abcF" : {%s : 1}}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3455 l[:] = [{"abcF" : {1 : 1}}]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3456 l[:] = [{"abcF" : {b"\0" : 1}}]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3457 l[:] = [{"abcF" : {"\0" : 1}}]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3458 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3459 >>> Testing StringToChars using l[:] = [{"abcF" : Mapping({%s : 1})}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3460 l[:] = [{"abcF" : Mapping({1 : 1})}]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3461 l[:] = [{"abcF" : Mapping({b"\0" : 1})}]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3462 l[:] = [{"abcF" : Mapping({"\0" : 1})}]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3463 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3464 >>> Testing *Iter* using l[:] = [{"abcF" : %s}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3465 l[:] = [{"abcF" : FailingIter()}]:(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3466 l[:] = [{"abcF" : FailingIterNext()}]:(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3467 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3468 >>> Testing ConvertFromPyObject using l[:] = [{"abcF" : %s}] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3469 l[:] = [{"abcF" : None}]:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3470 l[:] = [{"abcF" : {b"": 1}}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3471 l[:] = [{"abcF" : {"": 1}}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3472 l[:] = [{"abcF" : FailingMapping()}]:(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3473 l[:] = [{"abcF" : FailingMappingKey()}]:(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3474 l[:] = [{"abcF" : FailingNumber()}]:(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3475 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3476 >>> Testing StringToChars using l[:] = [Mapping({%s : 1})] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3477 l[:] = [Mapping({1 : 1})]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3478 l[:] = [Mapping({b"\0" : 1})]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3479 l[:] = [Mapping({"\0" : 1})]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3480 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3481 >>> Testing StringToChars using l[:] = [Mapping({"abcG" : {%s : 1}})] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3482 l[:] = [Mapping({"abcG" : {1 : 1}})]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3483 l[:] = [Mapping({"abcG" : {b"\0" : 1}})]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3484 l[:] = [Mapping({"abcG" : {"\0" : 1}})]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3485 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3486 >>> Testing StringToChars using l[:] = [Mapping({"abcG" : Mapping({%s : 1})})] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3487 l[:] = [Mapping({"abcG" : Mapping({1 : 1})})]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3488 l[:] = [Mapping({"abcG" : Mapping({b"\0" : 1})})]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3489 l[:] = [Mapping({"abcG" : Mapping({"\0" : 1})})]:(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3490 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3491 >>> Testing *Iter* using l[:] = [Mapping({"abcG" : %s})] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3492 l[:] = [Mapping({"abcG" : FailingIter()})]:(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3493 l[:] = [Mapping({"abcG" : FailingIterNext()})]:(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3494 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3495 >>> Testing ConvertFromPyObject using l[:] = [Mapping({"abcG" : %s})] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3496 l[:] = [Mapping({"abcG" : None})]:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3497 l[:] = [Mapping({"abcG" : {b"": 1}})]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3498 l[:] = [Mapping({"abcG" : {"": 1}})]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3499 l[:] = [Mapping({"abcG" : FailingMapping()})]:(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3500 l[:] = [Mapping({"abcG" : FailingMappingKey()})]:(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3501 l[:] = [Mapping({"abcG" : FailingNumber()})]:(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3502 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3503 >>> Testing *Iter* using l[:] = [%s] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3504 l[:] = [FailingIter()]:(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3505 l[:] = [FailingIterNext()]:(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3506 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3507 >>> Testing ConvertFromPyObject using l[:] = [%s] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3508 l[:] = [None]:NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3509 l[:] = [{b"": 1}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3510 l[:] = [{"": 1}]:(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3511 l[:] = [FailingMapping()]:(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3512 l[:] = [FailingMappingKey()]:(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3513 l[:] = [FailingNumber()]:(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3514 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3515 >> ListConcatInPlace |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3516 >>> Testing *Iter* using l.extend(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3517 l.extend(FailingIter()):(<class 'NotImplementedError'>, NotImplementedError('iter',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3518 l.extend(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3519 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3520 >>> Testing StringToChars using l.extend([{%s : 1}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3521 l.extend([{1 : 1}]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3522 l.extend([{b"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3523 l.extend([{"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3524 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3525 >>> Testing StringToChars using l.extend([{"abcF" : {%s : 1}}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3526 l.extend([{"abcF" : {1 : 1}}]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3527 l.extend([{"abcF" : {b"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3528 l.extend([{"abcF" : {"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3529 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3530 >>> Testing StringToChars using l.extend([{"abcF" : Mapping({%s : 1})}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3531 l.extend([{"abcF" : Mapping({1 : 1})}]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3532 l.extend([{"abcF" : Mapping({b"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3533 l.extend([{"abcF" : Mapping({"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3534 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3535 >>> Testing *Iter* using l.extend([{"abcF" : %s}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3536 l.extend([{"abcF" : FailingIter()}]):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3537 l.extend([{"abcF" : FailingIterNext()}]):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3538 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3539 >>> Testing ConvertFromPyObject using l.extend([{"abcF" : %s}]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3540 l.extend([{"abcF" : None}]):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3541 l.extend([{"abcF" : {b"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3542 l.extend([{"abcF" : {"": 1}}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3543 l.extend([{"abcF" : FailingMapping()}]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3544 l.extend([{"abcF" : FailingMappingKey()}]):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3545 l.extend([{"abcF" : FailingNumber()}]):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3546 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3547 >>> Testing StringToChars using l.extend([Mapping({%s : 1})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3548 l.extend([Mapping({1 : 1})]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3549 l.extend([Mapping({b"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3550 l.extend([Mapping({"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3551 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3552 >>> Testing StringToChars using l.extend([Mapping({"abcG" : {%s : 1}})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3553 l.extend([Mapping({"abcG" : {1 : 1}})]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3554 l.extend([Mapping({"abcG" : {b"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3555 l.extend([Mapping({"abcG" : {"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3556 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3557 >>> Testing StringToChars using l.extend([Mapping({"abcG" : Mapping({%s : 1})})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3558 l.extend([Mapping({"abcG" : Mapping({1 : 1})})]):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3559 l.extend([Mapping({"abcG" : Mapping({b"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3560 l.extend([Mapping({"abcG" : Mapping({"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3561 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3562 >>> Testing *Iter* using l.extend([Mapping({"abcG" : %s})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3563 l.extend([Mapping({"abcG" : FailingIter()})]):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3564 l.extend([Mapping({"abcG" : FailingIterNext()})]):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3565 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3566 >>> Testing ConvertFromPyObject using l.extend([Mapping({"abcG" : %s})]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3567 l.extend([Mapping({"abcG" : None})]):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3568 l.extend([Mapping({"abcG" : {b"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3569 l.extend([Mapping({"abcG" : {"": 1}})]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3570 l.extend([Mapping({"abcG" : FailingMapping()})]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3571 l.extend([Mapping({"abcG" : FailingMappingKey()})]):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3572 l.extend([Mapping({"abcG" : FailingNumber()})]):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3573 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3574 >>> Testing *Iter* using l.extend([%s]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3575 l.extend([FailingIter()]):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3576 l.extend([FailingIterNext()]):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3577 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3578 >>> Testing ConvertFromPyObject using l.extend([%s]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3579 l.extend([None]):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3580 l.extend([{b"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3581 l.extend([{"": 1}]):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3582 l.extend([FailingMapping()]):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3583 l.extend([FailingMappingKey()]):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3584 l.extend([FailingNumber()]):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3585 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3586 >> ListSetattr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3587 del l.locked:(<class 'AttributeError'>, AttributeError('cannot delete vim.List attributes',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3588 l.locked = FailingTrue():(<class 'NotImplementedError'>, NotImplementedError('bool',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3589 l.xxx = True:(<class 'AttributeError'>, AttributeError('cannot set attribute xxx',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3590 > Function |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3591 >> FunctionConstructor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3592 >>> FunctionConstructor |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3593 vim.Function("123"):(<class 'ValueError'>, ValueError('unnamed function 123 does not exist',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3594 vim.Function("xxx_non_existent_function_xxx"):(<class 'ValueError'>, ValueError('function xxx_non_existent_function_xxx does not exist',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3595 vim.Function("xxx#non#existent#function#xxx"):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3596 vim.Function("xxx_non_existent_function_xxx2", args=[]):(<class 'ValueError'>, ValueError('function xxx_non_existent_function_xxx2 does not exist',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3597 vim.Function("xxx_non_existent_function_xxx3", self={}):(<class 'ValueError'>, ValueError('function xxx_non_existent_function_xxx3 does not exist',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3598 vim.Function("xxx_non_existent_function_xxx4", args=[], self={}):(<class 'ValueError'>, ValueError('function xxx_non_existent_function_xxx4 does not exist',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3599 >>> FunctionNew |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3600 vim.Function("tr", self="abcFuncSelf"):(<class 'AttributeError'>, AttributeError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3601 vim.Function("tr", args=427423):(<class 'TypeError'>, TypeError('unable to convert int to a Vim list',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3602 vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2"):(<class 'AttributeError'>, AttributeError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3603 vim.Function(self="abcFuncSelf2", args="abcFuncArgs2"):(<class 'AttributeError'>, AttributeError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3604 vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2"):(<class 'AttributeError'>, AttributeError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3605 vim.Function("tr", ""):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3606 >> FunctionCall |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3607 >>> Testing StringToChars using f({%s : 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3608 f({1 : 1}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3609 f({b"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3610 f({"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3611 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3612 >>> Testing StringToChars using f({"abcF" : {%s : 1}}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3613 f({"abcF" : {1 : 1}}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3614 f({"abcF" : {b"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3615 f({"abcF" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3616 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3617 >>> Testing StringToChars using f({"abcF" : Mapping({%s : 1})}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3618 f({"abcF" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3619 f({"abcF" : Mapping({b"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3620 f({"abcF" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3621 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3622 >>> Testing *Iter* using f({"abcF" : %s}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3623 f({"abcF" : FailingIter()}):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3624 f({"abcF" : FailingIterNext()}):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3625 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3626 >>> Testing ConvertFromPyObject using f({"abcF" : %s}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3627 f({"abcF" : None}):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3628 f({"abcF" : {b"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3629 f({"abcF" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3630 f({"abcF" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3631 f({"abcF" : FailingMappingKey()}):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3632 f({"abcF" : FailingNumber()}):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3633 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3634 >>> Testing StringToChars using f(Mapping({%s : 1})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3635 f(Mapping({1 : 1})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3636 f(Mapping({b"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3637 f(Mapping({"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3638 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3639 >>> Testing StringToChars using f(Mapping({"abcG" : {%s : 1}})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3640 f(Mapping({"abcG" : {1 : 1}})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3641 f(Mapping({"abcG" : {b"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3642 f(Mapping({"abcG" : {"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3643 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3644 >>> Testing StringToChars using f(Mapping({"abcG" : Mapping({%s : 1})})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3645 f(Mapping({"abcG" : Mapping({1 : 1})})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3646 f(Mapping({"abcG" : Mapping({b"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3647 f(Mapping({"abcG" : Mapping({"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3648 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3649 >>> Testing *Iter* using f(Mapping({"abcG" : %s})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3650 f(Mapping({"abcG" : FailingIter()})):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3651 f(Mapping({"abcG" : FailingIterNext()})):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3652 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3653 >>> Testing ConvertFromPyObject using f(Mapping({"abcG" : %s})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3654 f(Mapping({"abcG" : None})):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3655 f(Mapping({"abcG" : {b"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3656 f(Mapping({"abcG" : {"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3657 f(Mapping({"abcG" : FailingMapping()})):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3658 f(Mapping({"abcG" : FailingMappingKey()})):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3659 f(Mapping({"abcG" : FailingNumber()})):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3660 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3661 >>> Testing *Iter* using f(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3662 f(FailingIter()):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3663 f(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3664 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3665 >>> Testing ConvertFromPyObject using f(%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3666 f(None):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3667 f({b"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3668 f({"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3669 f(FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3670 f(FailingMappingKey()):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3671 f(FailingNumber()):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3672 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3673 >>> Testing StringToChars using fd(self={%s : 1}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3674 fd(self={1 : 1}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3675 fd(self={b"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3676 fd(self={"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3677 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3678 >>> Testing StringToChars using fd(self={"abcF" : {%s : 1}}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3679 fd(self={"abcF" : {1 : 1}}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3680 fd(self={"abcF" : {b"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3681 fd(self={"abcF" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3682 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3683 >>> Testing StringToChars using fd(self={"abcF" : Mapping({%s : 1})}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3684 fd(self={"abcF" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3685 fd(self={"abcF" : Mapping({b"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3686 fd(self={"abcF" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3687 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3688 >>> Testing *Iter* using fd(self={"abcF" : %s}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3689 fd(self={"abcF" : FailingIter()}):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3690 fd(self={"abcF" : FailingIterNext()}):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3691 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3692 >>> Testing ConvertFromPyObject using fd(self={"abcF" : %s}) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3693 fd(self={"abcF" : None}):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3694 fd(self={"abcF" : {b"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3695 fd(self={"abcF" : {"": 1}}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3696 fd(self={"abcF" : FailingMapping()}):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3697 fd(self={"abcF" : FailingMappingKey()}):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3698 fd(self={"abcF" : FailingNumber()}):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3699 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3700 >>> Testing StringToChars using fd(self=Mapping({%s : 1})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3701 fd(self=Mapping({1 : 1})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3702 fd(self=Mapping({b"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3703 fd(self=Mapping({"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3704 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3705 >>> Testing StringToChars using fd(self=Mapping({"abcG" : {%s : 1}})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3706 fd(self=Mapping({"abcG" : {1 : 1}})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3707 fd(self=Mapping({"abcG" : {b"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3708 fd(self=Mapping({"abcG" : {"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3709 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3710 >>> Testing StringToChars using fd(self=Mapping({"abcG" : Mapping({%s : 1})})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3711 fd(self=Mapping({"abcG" : Mapping({1 : 1})})):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3712 fd(self=Mapping({"abcG" : Mapping({b"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3713 fd(self=Mapping({"abcG" : Mapping({"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3714 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3715 >>> Testing *Iter* using fd(self=Mapping({"abcG" : %s})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3716 fd(self=Mapping({"abcG" : FailingIter()})):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim structure',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3717 fd(self=Mapping({"abcG" : FailingIterNext()})):(<class 'NotImplementedError'>, NotImplementedError('next',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3718 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3719 >>> Testing ConvertFromPyObject using fd(self=Mapping({"abcG" : %s})) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3720 fd(self=Mapping({"abcG" : None})):NOT FAILED |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3721 fd(self=Mapping({"abcG" : {b"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3722 fd(self=Mapping({"abcG" : {"": 1}})):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3723 fd(self=Mapping({"abcG" : FailingMapping()})):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3724 fd(self=Mapping({"abcG" : FailingMappingKey()})):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3725 fd(self=Mapping({"abcG" : FailingNumber()})):(<class 'NotImplementedError'>, NotImplementedError('int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3726 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3727 >>> Testing *Iter* using fd(self=%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3728 fd(self=FailingIter()):(<class 'TypeError'>, TypeError('unable to convert FailingIter to a Vim dictionary',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3729 fd(self=FailingIterNext()):(<class 'TypeError'>, TypeError('unable to convert FailingIterNext to a Vim dictionary',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3730 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3731 >>> Testing ConvertFromPyObject using fd(self=%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3732 fd(self=None):(<class 'TypeError'>, TypeError('unable to convert NoneType to a Vim dictionary',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3733 fd(self={b"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3734 fd(self={"": 1}):(<class 'ValueError'>, ValueError('empty keys are not allowed',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3735 fd(self=FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3736 fd(self=FailingMappingKey()):(<class 'NotImplementedError'>, NotImplementedError('getitem:mappingkey',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3737 fd(self=FailingNumber()):(<class 'TypeError'>, TypeError('unable to convert FailingNumber to a Vim dictionary',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3738 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3739 >>> Testing ConvertFromPyMapping using fd(self=%s) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3740 fd(self=[]):(<class 'AttributeError'>, AttributeError('keys',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3741 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3742 > TabPage |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3743 >> TabPageAttr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3744 vim.current.tabpage.xxx:(<class 'AttributeError'>, AttributeError("'vim.tabpage' object has no attribute 'xxx'",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3745 > TabList |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3746 >> TabListItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3747 vim.tabpages[1000]:(<class 'IndexError'>, IndexError('no such tab page',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3748 > Window |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3749 >> WindowAttr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3750 vim.current.window.xxx:(<class 'AttributeError'>, AttributeError("'vim.window' object has no attribute 'xxx'",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3751 >> WindowSetattr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3752 vim.current.window.buffer = 0:(<class 'TypeError'>, TypeError('readonly attribute: buffer',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3753 vim.current.window.cursor = (100000000, 100000000):(<class 'vim.error'>, error('cursor position outside buffer',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3754 vim.current.window.cursor = True:(<class 'TypeError'>, TypeError('argument must be 2-item sequence, not bool',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3755 >>> Testing NumberToLong using vim.current.window.height = %s |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3756 vim.current.window.height = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3757 vim.current.window.height = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3758 vim.current.window.height = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3759 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3760 >>> Testing NumberToLong using vim.current.window.width = %s |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3761 vim.current.window.width = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3762 vim.current.window.width = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3763 vim.current.window.width = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3764 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3765 vim.current.window.xxxxxx = True:(<class 'AttributeError'>, AttributeError('xxxxxx',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3766 > WinList |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3767 >> WinListItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3768 vim.windows[1000]:(<class 'IndexError'>, IndexError('no such window',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3769 > Buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3770 >> StringToLine (indirect) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3771 vim.current.buffer[0] = "\na":(<class 'vim.error'>, error('string cannot contain newlines',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3772 vim.current.buffer[0] = b"\na":(<class 'vim.error'>, error('string cannot contain newlines',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3773 >> SetBufferLine (indirect) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3774 vim.current.buffer[0] = True:(<class 'TypeError'>, TypeError('bad argument type for built-in operation',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3775 >> SetBufferLineList (indirect) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3776 vim.current.buffer[:] = True:(<class 'TypeError'>, TypeError('bad argument type for built-in operation',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3777 vim.current.buffer[:] = ["\na", "bc"]:(<class 'vim.error'>, error('string cannot contain newlines',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3778 >> InsertBufferLines (indirect) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3779 vim.current.buffer.append(None):(<class 'TypeError'>, TypeError('bad argument type for built-in operation',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3780 vim.current.buffer.append(["\na", "bc"]):(<class 'vim.error'>, error('string cannot contain newlines',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3781 vim.current.buffer.append("\nbc"):(<class 'vim.error'>, error('string cannot contain newlines',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3782 >> RBItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3783 vim.current.buffer[100000000]:(<class 'IndexError'>, IndexError('line number out of range',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3784 >> RBAsItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3785 vim.current.buffer[100000000] = "":(<class 'IndexError'>, IndexError('line number out of range',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3786 >> BufferAttr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3787 vim.current.buffer.xxx:(<class 'AttributeError'>, AttributeError("'vim.buffer' object has no attribute 'xxx'",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3788 >> BufferSetattr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3789 vim.current.buffer.name = True:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got bool',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3790 vim.current.buffer.xxx = True:(<class 'AttributeError'>, AttributeError('xxx',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3791 >> BufferMark |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3792 vim.current.buffer.mark(0):(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3793 vim.current.buffer.mark("abcM"):(<class 'ValueError'>, ValueError('mark name must be a single character',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3794 vim.current.buffer.mark("!"):(<class 'vim.error'>, error('invalid mark name',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3795 >> BufferRange |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3796 vim.current.buffer.range(1, 2, 3):(<class 'TypeError'>, TypeError('function takes exactly 2 arguments (3 given)',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3797 > BufMap |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3798 >> BufMapItem |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3799 vim.buffers[100000000]:(<class 'KeyError'>, KeyError(100000000,)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3800 >>> Testing NumberToLong using vim.buffers[%s] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3801 vim.buffers[[]]:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3802 vim.buffers[None]:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3803 vim.buffers[-1]:(<class 'ValueError'>, ValueError('number must be greater than zero',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3804 vim.buffers[0]:(<class 'ValueError'>, ValueError('number must be greater than zero',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3805 <<< Finished |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3806 > Current |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3807 >> CurrentGetattr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3808 vim.current.xxx:(<class 'AttributeError'>, AttributeError("'vim.currentdata' object has no attribute 'xxx'",)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3809 >> CurrentSetattr |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3810 vim.current.line = True:(<class 'TypeError'>, TypeError('bad argument type for built-in operation',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3811 vim.current.buffer = True:(<class 'TypeError'>, TypeError('expected vim.Buffer object, but got bool',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3812 vim.current.window = True:(<class 'TypeError'>, TypeError('expected vim.Window object, but got bool',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3813 vim.current.tabpage = True:(<class 'TypeError'>, TypeError('expected vim.TabPage object, but got bool',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3814 vim.current.xxx = True:(<class 'AttributeError'>, AttributeError('xxx',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3815 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3816 |
22728
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3817 let actual = getline(2, '$') |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3818 let n_expected = len(expected) |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3819 let n_actual = len(actual) |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3820 call assert_equal(n_expected, n_actual, 'number of lines to compare') |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3821 |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3822 " Compare line by line so the errors are easier to understand. Missing lines |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3823 " are compared with an empty string. |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3824 for i in range(n_expected > n_actual ? n_expected : n_actual) |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3825 call assert_equal(i >= n_expected ? '' : expected[i], i >= n_actual ? '' : actual[i]) |
1928f863ac6e
patch 8.2.1912: with Python 3.9 some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22011
diff
changeset
|
3826 endfor |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3827 close! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3828 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3829 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3830 " Test import |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3831 func Test_python3_import() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3832 new |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3833 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3834 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3835 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3836 sys.path.insert(0, os.path.join(os.getcwd(), 'python_before')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3837 sys.path.append(os.path.join(os.getcwd(), 'python_after')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3838 vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3839 l = [] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3840 def callback(path): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3841 l.append(os.path.relpath(path)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3842 vim.foreach_rtp(callback) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3843 cb.append(repr(l)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3844 del l |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3845 def callback(path): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3846 return os.path.relpath(path) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3847 cb.append(repr(vim.foreach_rtp(callback))) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3848 del callback |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3849 from module import dir as d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3850 from modulex import ddir |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3851 cb.append(d + ',' + ddir) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3852 import before |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3853 cb.append(before.dir) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3854 import after |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3855 cb.append(after.dir) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3856 import topmodule as tm |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3857 import topmodule.submodule as tms |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3858 import topmodule.submodule.subsubmodule.subsubsubmodule as tmsss |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3859 cb.append(tm.__file__.replace(os.path.sep, '/')[-len('modulex/topmodule/__init__.py'):]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3860 cb.append(tms.__file__.replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/__init__.py'):]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3861 cb.append(tmsss.__file__.replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/subsubmodule/subsubsubmodule.py'):]) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3862 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3863 del before |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3864 del after |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3865 del d |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3866 del ddir |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3867 del tm |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3868 del tms |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3869 del tmsss |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3870 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3871 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3872 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3873 ['.'] |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3874 '.' |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3875 3,xx |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3876 before |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3877 after |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3878 pythonx/topmodule/__init__.py |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3879 pythonx/topmodule/submodule/__init__.py |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3880 pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3881 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3882 call assert_equal(expected, getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3883 close! |
21190
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
3884 |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
3885 " Try to import a non-existing moudle with a dot (.) |
10eb6c38938c
patch 8.2.1146: not enough testing for Python
Bram Moolenaar <Bram@vim.org>
parents:
21144
diff
changeset
|
3886 call AssertException(['py3 import a.b.c'], "No module named 'a'") |
21144
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3887 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3888 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3889 " Test exceptions |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3890 func Test_python3_exception() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3891 func Exe(e) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3892 execute a:e |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3893 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3894 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3895 new |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3896 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3897 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3898 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3899 Exe = vim.bindeval('function("Exe")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3900 ee('vim.command("throw \'abcN\'")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3901 ee('Exe("throw \'def\'")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3902 ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3903 ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3904 ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3905 ee('vim.eval("xxx_unknown_function_xxx()")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3906 ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3907 del Exe |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3908 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3909 delfunction Exe |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3910 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3911 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3912 vim.command("throw 'abcN'"):(<class 'vim.error'>, error('abcN',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3913 Exe("throw 'def'"):(<class 'vim.error'>, error('def',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3914 vim.eval("Exe('throw ''ghi''')"):(<class 'vim.error'>, error('ghi',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3915 vim.eval("Exe('echoerr ''jkl''')"):(<class 'vim.error'>, error('Vim(echoerr):jkl',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3916 vim.eval("Exe('xxx_non_existent_command_xxx')"):(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3917 vim.eval("xxx_unknown_function_xxx()"):(<class 'vim.error'>, error('Vim:E117: Unknown function: xxx_unknown_function_xxx',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3918 vim.bindeval("Exe('xxx_non_existent_command_xxx')"):(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',)) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3919 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3920 call assert_equal(expected, getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3921 close! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3922 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3923 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3924 " Regression: interrupting vim.command propagates to next vim.command |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3925 func Test_python3_keyboard_interrupt() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3926 new |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3927 py3 cb = vim.current.buffer |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3928 py3 << trim EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3929 def test_keyboard_interrupt(): |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3930 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3931 vim.command('while 1 | endwhile') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3932 except KeyboardInterrupt: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3933 cb.append('Caught KeyboardInterrupt') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3934 except Exception: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3935 cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3936 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3937 cb.append('!!!!!!!! No exception') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3938 try: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3939 vim.command('$ put =\'Running :put\'') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3940 except KeyboardInterrupt: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3941 cb.append('!!!!!!!! Caught KeyboardInterrupt') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3942 except Exception: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3943 cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3944 else: |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3945 cb.append('No exception') |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3946 EOF |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3947 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3948 debuggreedy |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3949 call inputsave() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3950 call feedkeys("s\ns\ns\ns\nq\n") |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3951 redir => output |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3952 debug silent! py3 test_keyboard_interrupt() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3953 redir END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3954 0 debuggreedy |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3955 call inputrestore() |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3956 py3 del test_keyboard_interrupt |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3957 |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3958 let expected =<< trim END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3959 Caught KeyboardInterrupt |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3960 Running :put |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3961 No exception |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3962 END |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3963 call assert_equal(expected, getline(2, '$')) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3964 call assert_equal('', output) |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3965 close! |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3966 endfunc |
adae19565eea
patch 8.2.1123: Python 3 test is old style
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
3967 |
21977
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3968 " Regression: Iterator for a Vim object should hold a reference. |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3969 func Test_python3_iter_ref() |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3970 let g:list_iter_ref_count_increase = -1 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3971 let g:dict_iter_ref_count_increase = -1 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3972 let g:bufmap_iter_ref_count_increase = -1 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3973 let g:options_iter_ref_count_increase = -1 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3974 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3975 py3 << trim EOF |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3976 import sys |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3977 import vim |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3978 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3979 def test_python3_iter_ref(): |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3980 create_list = vim.Function('Create_vim_list') |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3981 v = create_list() |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3982 base_ref_count = sys.getrefcount(v) |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3983 for el in v: |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3984 vim.vars['list_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3985 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3986 create_dict = vim.Function('Create_vim_dict') |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3987 v = create_dict() |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3988 base_ref_count = sys.getrefcount(v) |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3989 for el in v: |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3990 vim.vars['dict_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3991 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3992 v = vim.buffers |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3993 base_ref_count = sys.getrefcount(v) |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3994 for el in v: |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3995 vim.vars['bufmap_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3996 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3997 v = vim.options |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3998 base_ref_count = sys.getrefcount(v) |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3999 for el in v: |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4000 vim.vars['options_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4001 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4002 test_python3_iter_ref() |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4003 EOF |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4004 |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4005 call assert_equal(1, g:list_iter_ref_count_increase) |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4006 call assert_equal(1, g:dict_iter_ref_count_increase) |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4007 call assert_equal(1, g:bufmap_iter_ref_count_increase) |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4008 call assert_equal(1, g:options_iter_ref_count_increase) |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4009 endfunc |
d1a7088c6efe
patch 8.2.1538: Python: iteration over vim objects fails to keep reference
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4010 |
19991
f27473034f26
patch 8.2.0551: not all code for options is tested
Bram Moolenaar <Bram@vim.org>
parents:
19499
diff
changeset
|
4011 " vim: shiftwidth=2 sts=2 expandtab |