updated for version 7.3.1062
Problem: Python: List is not standard.
Solution: Python patch 21: Add standard methods and fields. (ZyX)
diff --git a/src/testdir/test86.in b/src/testdir/test86.in
index 28adb70..dfba65d 100644
--- a/src/testdir/test86.in
+++ b/src/testdir/test86.in
@@ -735,6 +735,8 @@
:$put =string(pyeval('vim.Dictionary({})'))
:$put =string(pyeval('vim.Dictionary(a=1)'))
:$put =string(pyeval('vim.Dictionary(((''a'', 1),))'))
+:$put =string(pyeval('vim.List()'))
+:$put =string(pyeval('vim.List(iter(''abc''))'))
:"
:" Test stdout/stderr
:redir => messages
@@ -752,8 +754,18 @@
super(DupDict, self).__setitem__('dup_' + key, value)
dd = DupDict()
dd['a'] = 'b'
+
+class DupList(vim.List):
+ def __getitem__(self, idx):
+ return [super(DupList, self).__getitem__(idx)] * 2
+
+dl = DupList()
+dl2 = DupList(iter('abc'))
+dl.extend(dl2[0])
EOF
:$put =string(sort(keys(pyeval('dd'))))
+:$put =string(pyeval('dl'))
+:$put =string(pyeval('dl2'))
:"
:" Test exceptions
:fun Exe(e)
diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok
index 200af04..b484ec6 100644
--- a/src/testdir/test86.ok
+++ b/src/testdir/test86.ok
@@ -412,6 +412,8 @@
{}
{'a': 1}
{'a': 1}
+[]
+['a', 'b', 'c']
'
abcdef
line :
@@ -420,6 +422,8 @@
line :
abc'
['a', 'dup_a']
+['a', 'a']
+['a', 'b', 'c']
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))
diff --git a/src/testdir/test87.in b/src/testdir/test87.in
index 20f616f..82edc8b 100644
--- a/src/testdir/test87.in
+++ b/src/testdir/test87.in
@@ -692,10 +692,12 @@
del o
EOF
:"
-:" Test vim.Dictionary.__new__
+:" Test vim.*.__new__
:$put =string(py3eval('vim.Dictionary({})'))
:$put =string(py3eval('vim.Dictionary(a=1)'))
:$put =string(py3eval('vim.Dictionary(((''a'', 1),))'))
+:$put =string(py3eval('vim.List()'))
+:$put =string(py3eval('vim.List(iter(''abc''))'))
:"
:" Test stdout/stderr
:redir => messages
@@ -713,8 +715,18 @@
super(DupDict, self).__setitem__('dup_' + key, value)
dd = DupDict()
dd['a'] = 'b'
+
+class DupList(vim.List):
+ def __getitem__(self, idx):
+ return [super(DupList, self).__getitem__(idx)] * 2
+
+dl = DupList()
+dl2 = DupList(iter('abc'))
+dl.extend(dl2[0])
EOF
:$put =string(sort(keys(py3eval('dd'))))
+:$put =string(py3eval('dl'))
+:$put =string(py3eval('dl2'))
:"
:" Test exceptions
:fun Exe(e)
diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok
index b92d65c..0945396 100644
--- a/src/testdir/test87.ok
+++ b/src/testdir/test87.ok
@@ -401,6 +401,8 @@
{}
{'a': 1}
{'a': 1}
+[]
+['a', 'b', 'c']
'
abcdef
line :
@@ -409,6 +411,8 @@
line :
abc'
['a', 'dup_a']
+['a', 'a']
+['a', 'b', 'c']
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))