Issues (18)

test/test_tabpage.py (1 issue)

1
import pytest
2
3
4
def test_windows(vim):
5
    vim.command('tabnew')
6
    vim.command('vsplit')
7
    assert list(vim.tabpages[0].windows) == [vim.windows[0]]
8
    assert list(vim.tabpages[1].windows) == [vim.windows[1], vim.windows[2]]
9
    assert vim.tabpages[1].window == vim.windows[1]
10
    vim.current.window = vim.windows[2]
11
    assert vim.tabpages[1].window == vim.windows[2]
12
13
14 View Code Duplication
def test_vars(vim):
0 ignored issues
show
This code seems to be duplicated in your project.
Loading history...
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):
32
    vim.command('tabnew')
33
    tabpage = vim.tabpages[1]
34
    assert tabpage.valid
35
    vim.command('tabclose')
36
    assert not tabpage.valid
37
38
39
def test_number(vim):
40
    curnum = vim.current.tabpage.number
41
    vim.command('tabnew')
42
    assert vim.current.tabpage.number == curnum + 1
43
    vim.command('tabnew')
44
    assert vim.current.tabpage.number == curnum + 2
45
46
47
def test_repr(vim):
48
    assert repr(vim.current.tabpage) == "<Tabpage(handle=1)>"
49