| @@ 100-114 (lines=15) @@ | ||
| 97 | assert len(vim.current.buffer[:]) == 1 and not vim.current.buffer[0] |
|
| 98 | ||
| 99 | ||
| 100 | def test_vars(vim): |
|
| 101 | vim.vars['python'] = [1, 2, {'3': 1}] |
|
| 102 | assert vim.vars['python'], [1, 2 == {'3': 1}] |
|
| 103 | assert vim.eval('g:python'), [1, 2 == {'3': 1}] |
|
| 104 | assert vim.vars.get('python') == [1, 2, {'3': 1}] |
|
| 105 | ||
| 106 | del vim.vars['python'] |
|
| 107 | with pytest.raises(KeyError): |
|
| 108 | vim.vars['python'] |
|
| 109 | assert vim.eval('exists("g:python")') == 0 |
|
| 110 | ||
| 111 | with pytest.raises(KeyError): |
|
| 112 | del vim.vars['python'] |
|
| 113 | ||
| 114 | assert vim.vars.get('python', 'default') == 'default' |
|
| 115 | ||
| 116 | ||
| 117 | def test_options(vim): |
|
| @@ 76-90 (lines=15) @@ | ||
| 73 | assert vim.current.buffer[:] == ['c'] |
|
| 74 | ||
| 75 | ||
| 76 | def test_vars(vim): |
|
| 77 | vim.current.buffer.vars['python'] = [1, 2, {'3': 1}] |
|
| 78 | assert vim.current.buffer.vars['python'] == [1, 2, {'3': 1}] |
|
| 79 | assert vim.eval('b:python') == [1, 2, {'3': 1}] |
|
| 80 | assert vim.current.buffer.vars.get('python') == [1, 2, {'3': 1}] |
|
| 81 | ||
| 82 | del vim.current.buffer.vars['python'] |
|
| 83 | with pytest.raises(KeyError): |
|
| 84 | vim.current.buffer.vars['python'] |
|
| 85 | assert vim.eval('exists("b:python")') == 0 |
|
| 86 | ||
| 87 | with pytest.raises(KeyError): |
|
| 88 | del vim.current.buffer.vars['python'] |
|
| 89 | ||
| 90 | assert vim.current.buffer.vars.get('python', 'default') == 'default' |
|
| 91 | ||
| 92 | ||
| 93 | def test_api(vim): |
|
| @@ 42-56 (lines=15) @@ | ||
| 39 | assert vim.windows[1].width == 2 |
|
| 40 | ||
| 41 | ||
| 42 | def test_vars(vim): |
|
| 43 | vim.current.window.vars['python'] = [1, 2, {'3': 1}] |
|
| 44 | assert vim.current.window.vars['python'] == [1, 2, {'3': 1}] |
|
| 45 | assert vim.eval('w:python') == [1, 2, {'3': 1}] |
|
| 46 | assert vim.current.window.vars.get('python') == [1, 2, {'3': 1}] |
|
| 47 | ||
| 48 | del vim.current.window.vars['python'] |
|
| 49 | with pytest.raises(KeyError): |
|
| 50 | vim.current.window.vars['python'] |
|
| 51 | assert vim.eval('exists("w:python")') == 0 |
|
| 52 | ||
| 53 | with pytest.raises(KeyError): |
|
| 54 | del vim.current.window.vars['python'] |
|
| 55 | ||
| 56 | assert vim.current.window.vars.get('python', 'default') == 'default' |
|
| 57 | ||
| 58 | ||
| 59 | def test_options(vim): |
|
| @@ 14-28 (lines=15) @@ | ||
| 11 | assert vim.tabpages[1].window == vim.windows[2] |
|
| 12 | ||
| 13 | ||
| 14 | def test_vars(vim): |
|
| 15 | vim.current.tabpage.vars['python'] = [1, 2, {'3': 1}] |
|
| 16 | assert vim.current.tabpage.vars['python'] == [1, 2, {'3': 1}] |
|
| 17 | assert vim.eval('t:python') == [1, 2, {'3': 1}] |
|
| 18 | assert vim.current.tabpage.vars.get('python') == [1, 2, {'3': 1}] |
|
| 19 | ||
| 20 | del vim.current.tabpage.vars['python'] |
|
| 21 | with pytest.raises(KeyError): |
|
| 22 | vim.current.tabpage.vars['python'] |
|
| 23 | assert vim.eval('exists("t:python")') == 0 |
|
| 24 | ||
| 25 | with pytest.raises(KeyError): |
|
| 26 | del vim.current.tabpage.vars['python'] |
|
| 27 | ||
| 28 | assert vim.current.tabpage.vars.get('python', 'default') == 'default' |
|
| 29 | ||
| 30 | ||
| 31 | def test_valid(vim): |
|