<s> import os <EOL> from nose . tools import with_setup , eq_ as eq , ok_ as ok <EOL> from test_common import vim , cleanup <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_buffer ( ) : <EOL> eq ( vim . current . buffer , vim . windows [ <NUM_LIT:0> ] . buffer ) <EOL> vim . command ( '<STR_LIT>' ) <EOL> vim . current . window = vim . windows [ <NUM_LIT:1> ] <EOL> eq ( vim . current . buffer , vim . windows [ <NUM_LIT:1> ] . buffer ) <EOL> ok ( vim . windows [ <NUM_LIT:0> ] . buffer != vim . windows [ <NUM_LIT:1> ] . buffer ) <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_cursor ( ) : <EOL> eq ( vim . current . window . cursor , [ <NUM_LIT:1> , <NUM_LIT:0> ] ) <EOL> vim . command ( '<STR_LIT>' ) <EOL> eq ( vim . current . buffer [ : ] , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> eq ( vim . current . window . cursor , [ <NUM_LIT:2> , <NUM_LIT:10> ] ) <EOL> vim . current . window . cursor = [ <NUM_LIT:2> , <NUM_LIT:6> ] <EOL> vim . command ( '<STR_LIT>' ) <EOL> eq ( vim . current . buffer [ : ] , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_height ( ) : <EOL> vim . command ( '<STR_LIT>' ) <EOL> eq ( vim . windows [ <NUM_LIT:1> ] . height , vim . windows [ <NUM_LIT:0> ] . height ) <EOL> vim . current . window = vim . windows [ <NUM_LIT:1> ] <EOL> vim . command ( '<STR_LIT>' ) <EOL> eq ( vim . windows [ <NUM_LIT:1> ] . height , vim . windows [ <NUM_LIT:0> ] . height // <NUM_LIT:2> ) <EOL> vim . windows [ <NUM_LIT:1> ] . height = <NUM_LIT:2> <EOL> eq ( vim . windows [ <NUM_LIT:1> ] . height , <NUM_LIT:2> ) <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_width ( ) : <EOL> vim . command ( '<STR_LIT>' ) <EOL> eq ( vim . windows [ <NUM_LIT:1> ] . width , vim . windows [ <NUM_LIT:0> ] . width ) <EOL> vim . current . window = vim . windows [ <NUM_LIT:1> ] <EOL> vim . command ( '<STR_LIT>' ) <EOL> eq ( vim . windows [ <NUM_LIT:1> ] . width , vim . windows [ <NUM_LIT:0> ] . width // <NUM_LIT:2> ) <EOL> vim . windows [ <NUM_LIT:1> ] . width = <NUM_LIT:2> <EOL> eq ( vim . windows [ <NUM_LIT:1> ] . width , <NUM_LIT:2> ) <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_vars ( ) : <EOL> vim . current . window . vars [ '<STR_LIT>' ] = [ <NUM_LIT:1> , <NUM_LIT:2> , { '<STR_LIT:3>' : <NUM_LIT:1> } ] <EOL> eq ( vim . current . window . vars [ '<STR_LIT>' ] , [ <NUM_LIT:1> , <NUM_LIT:2> , { '<STR_LIT:3>' : <NUM_LIT:1> } ] ) <EOL> eq ( vim . eval ( '<STR_LIT>' ) , [ <NUM_LIT:1> , <NUM_LIT:2> , { '<STR_LIT:3>' : <NUM_LIT:1> } ] ) <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_options ( ) : <EOL> vim . current . window . options [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> eq ( vim . current . window . options [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> vim . current . window . options [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> eq ( vim . current . window . options [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> eq ( vim . options [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_position ( ) : <EOL> height = vim . windows [ <NUM_LIT:0> ] . height <EOL> width = vim . windows [ <NUM_LIT:0> ] . width <EOL> vim . command ( '<STR_LIT>' ) <EOL> vim . command ( '<STR_LIT>' ) <EOL> eq ( ( vim . windows [ <NUM_LIT:0> ] . row , vim . windows [ <NUM_LIT:0> ] . col ) , ( <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> vsplit_pos = width / <NUM_LIT:2> <EOL> split_pos = height / <NUM_LIT:2> <EOL> eq ( vim . windows [ <NUM_LIT:1> ] . row , <NUM_LIT:0> ) <EOL> ok ( vsplit_pos - <NUM_LIT:1> <= vim . windows [ <NUM_LIT:1> ] . col <= vsplit_pos + <NUM_LIT:1> ) <EOL> ok ( split_pos - <NUM_LIT:1> <= vim . windows [ <NUM_LIT:2> ] . row <= split_pos + <NUM_LIT:1> ) <EOL> eq ( vim . windows [ <NUM_LIT:2> ] . col , <NUM_LIT:0> ) <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_tabpage ( ) : <EOL> vim . command ( '<STR_LIT>' ) <EOL> vim . command ( '<STR_LIT>' ) <EOL> eq ( vim . windows [ <NUM_LIT:0> ] . tabpage , vim . tabpages [ <NUM_LIT:0> ] ) <EOL> eq ( vim . windows [ <NUM_LIT:1> ] . tabpage , vim . tabpages [ <NUM_LIT:1> ] ) <EOL> eq ( vim . windows [ <NUM_LIT:2> ] . tabpage , vim . tabpages [ <NUM_LIT:1> ] ) <EOL> @ with_setup ( setup = cleanup ) <EOL> def test_valid ( ) : <EOL> vim . command ( '<STR_LIT>' ) <EOL> window = vim . windows [ <NUM_LIT:1> ] <EOL> vim . current . window = window <EOL> ok ( window . valid ) <EOL> vim . command ( '<STR_LIT:q>' ) <EOL> ok ( not window . valid ) </s>
