diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-07-07 20:50:39 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-07-07 20:50:39 +0200 |
commit | 0ab55d62012c1fb38c4b540a4233421820a59389 (patch) | |
tree | 1722bfccf85921e20333516045cfb9a3d2a9ba75 /src/testdir/test_python2.vim | |
parent | bb790dcc46b74e6f9a1c4126be8a575f9fe73444 (diff) |
patch 8.2.1151: insufficient test coverage for Pythonv8.2.1151
Problem: Insufficient test coverage for Python.
Solution: Add more test cases. (Yegappan Lakshmanan, closes #6415)
Diffstat (limited to 'src/testdir/test_python2.vim')
-rw-r--r-- | src/testdir/test_python2.vim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim index 0d41f391a3..42fadaab69 100644 --- a/src/testdir/test_python2.vim +++ b/src/testdir/test_python2.vim @@ -623,6 +623,9 @@ func Test_python_slice_assignment() py l = vim.bindeval('l') py l[2:2:1] = () call assert_equal([0, 1, 2, 3, 4, 5, 6, 7], l) + + call AssertException(["py x = l[10:11:0]"], + \ "Vim(python):ValueError: slice step cannot be zero") endfunc " Locked variables @@ -809,6 +812,10 @@ func Test_python_vim_bindeval() call assert_equal(0, pyeval("vim.bindeval('v:false')")) call assert_equal(v:none, pyeval("vim.bindeval('v:null')")) call assert_equal(v:none, pyeval("vim.bindeval('v:none')")) + + " channel/job + call assert_equal(v:none, pyeval("vim.bindeval('test_null_channel()')")) + call assert_equal(v:none, pyeval("vim.bindeval('test_null_job()')")) endfunc " threading @@ -1402,6 +1409,20 @@ func Test_python_buffer() call assert_equal([], pyeval('b[2:0]')) call assert_equal([], pyeval('b[10:12]')) call assert_equal([], pyeval('b[-10:-8]')) + call AssertException(["py x = b[0:3:0]"], + \ "Vim(python):TypeError: sequence index must be integer, not 'slice'") + call AssertException(["py b[0:3:0] = 'abc'"], + \ "Vim(python):TypeError: sequence index must be integer, not 'slice'") + call AssertException(["py x = b[{}]"], + \ "Vim(python):TypeError: sequence index must be integer, not 'dict'") + call AssertException(["py b[{}] = 'abc'"], + \ "Vim(python):TypeError: sequence index must be integer, not 'dict'") + + " Test for getting lines using a range + call AssertException(["py x = b.range(0,3)[0:2:0]"], + \ "Vim(python):TypeError: sequence index must be integer, not 'slice'") + call AssertException(["py b.range(0,3)[0:2:0] = 'abc'"], + \ "Vim(python):TypeError: sequence index must be integer, not 'slice'") " Tests BufferAppend and BufferItem py cb.append(b[0]) @@ -1512,6 +1533,9 @@ func Test_python_buffer() py vim.current.buffer[:] = [] call assert_equal([''], getline(1, '$')) + " Test for buffer marks + call assert_equal(v:none, pyeval("vim.current.buffer.mark('r')")) + " Test for modifying a 'nomodifiable' buffer setlocal nomodifiable call AssertException(["py vim.current.buffer[0] = 'abc'"], @@ -2408,6 +2432,7 @@ func Test_python_chdir() call assert_equal(['testdir', 'Xfile', 'src', 'testdir/Xfile', 'testdir', \ 'Xfile'], getline(2, '$')) close! + call AssertException(["py vim.chdir(None)"], "Vim(python):TypeError:") endfunc " Test errors |