def test_nowrap(self): class C: nowrap = True rows = screen.col_splitter(4, 0, '0123456789', [1]*10, list(range(10)), [0]*10, [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], {1:C}) row1, row2, row3, row4 = rows assert row1.chars == '01' assert row2.chars == '234' assert row3.chars == '567' assert row4.chars == '89' rows = screen.col_splitter(3, 0, '0123456789', [1]*10, list(range(10)), [0]*10, [1, 1, 1, 1, 1, 0, 0, 0, 0, 0], {1:C}) row1, row2, row3, row4, row5 = rows assert row1.chars == '01' assert row2.chars == '23' assert row3.chars == '45' assert row4.chars == '67' assert row5.chars == '89' rows = screen.col_splitter(3, 0, '0123456789', [1]*10, list(range(10)), [0]*10, [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], {1:C}) row1, row2, row3, row4, row5 = rows assert row1.chars == '01' assert row2.chars == '23' assert row3.chars == '45' assert row4.chars == '67' assert row5.chars == '89'
def test_nowrap(self): class C: nowrap = True rows = screen.col_splitter(4, 0, '0123456789', [1] * 10, list(range(10)), [0] * 10, [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], {1: C}) row1, row2, row3, row4 = rows assert row1.chars == '01' assert row2.chars == '234' assert row3.chars == '567' assert row4.chars == '89' rows = screen.col_splitter(3, 0, '0123456789', [1] * 10, list(range(10)), [0] * 10, [1, 1, 1, 1, 1, 0, 0, 0, 0, 0], {1: C}) row1, row2, row3, row4, row5 = rows assert row1.chars == '01' assert row2.chars == '23' assert row3.chars == '45' assert row4.chars == '67' assert row5.chars == '89' rows = screen.col_splitter(3, 0, '0123456789', [1] * 10, list(range(10)), [0] * 10, [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], {1: C}) row1, row2, row3, row4, row5 = rows assert row1.chars == '01' assert row2.chars == '23' assert row3.chars == '45' assert row4.chars == '67' assert row5.chars == '89'
def test_controlchr(self): chrs, cols, positions, intervals = screen.translate_chars(0, '\x01\x02\x03\x7f', 8) rows = screen.col_splitter(6, 0, chrs, cols, positions, intervals, [0]*4, {}) row1, row2, row3, row4 = rows assert row1.chars == '\\x01\\' assert row2.chars == 'x02\\x' assert row3.chars == '03\\x7' assert row4.chars == 'f'
def test_newline(self): rows = screen.col_splitter(5, 0, '0123\n', [1]*5, list(range(5)), [1]*5, [0]*5, {}) row, = rows assert row.chars == '0123\n' assert row.cols == [1,1,1,1,1] assert row.positions == [0,1,2,3,4] assert row.posfrom == 0 assert row.posto == 5
def test_empty(self): rows = screen.col_splitter(5, 0, [], [], [], [], [], {}) row, = rows assert row.chars == [] assert row.cols == [] assert row.positions == [] assert row.posfrom == 0 assert row.posto == 0
def test_newline(self): rows = screen.col_splitter(5, 0, '0123\n', [1] * 5, list(range(5)), [1] * 5, [0] * 5, {}) row, = rows assert row.chars == '0123\n' assert row.cols == [1, 1, 1, 1, 1] assert row.positions == [0, 1, 2, 3, 4] assert row.posfrom == 0 assert row.posto == 5
def test_controlchr(self): chrs, cols, positions, intervals = screen.translate_chars( 0, '\x01\x02\x03\x7f', 8, 2) rows = screen.col_splitter(6, 0, chrs, cols, positions, intervals, [0] * 4, {}) row1, row2, row3, row4 = rows assert row1.chars == '\\x01\\' assert row2.chars == 'x02\\x' assert row3.chars == '03\\x7' assert row4.chars == 'f'
def test_split(self): rows = screen.col_splitter(6, 0, '0123456789', [1]*10, list(range(10)), [0]*10, [0]*10, {}) row1, row2 = rows assert row1.chars == '01234' assert row1.cols == [1,1,1,1,1] assert row1.positions == [0,1,2,3,4] assert row1.posfrom == 0 assert row1.posto == 5 assert row2.chars == '56789' assert row2.cols == [1,1,1,1,1] assert row2.positions == [5,6,7,8,9] assert row2.posfrom == 5 assert row2.posto == 10
def test_combine(self): rows = screen.col_splitter(3, 0, '0\u0300\u0300\u0300\u0300\u0300\u030012', [1,0,0,0,0,0,0,1,1], list(range(9)), [0]*9, [0]*9, {}) row1, row2 = rows assert row1.chars == '0\u0300\u0300\u0300\u0300\u0300\u03001' assert row1.cols == [1,0,0,0,0,0,0,1] assert row1.positions == [0,1,2,3,4,5,6,7] assert row1.posfrom == 0 assert row1.posto == 8 assert row2.chars == '2' assert row2.cols == [1] assert row2.positions == [8] assert row2.posfrom == 8 assert row2.posto == 9
def test_split(self): rows = screen.col_splitter(6, 0, '0123456789', [1] * 10, list(range(10)), [0] * 10, [0] * 10, {}) row1, row2 = rows assert row1.chars == '01234' assert row1.cols == [1, 1, 1, 1, 1] assert row1.positions == [0, 1, 2, 3, 4] assert row1.posfrom == 0 assert row1.posto == 5 assert row2.chars == '56789' assert row2.cols == [1, 1, 1, 1, 1] assert row2.positions == [5, 6, 7, 8, 9] assert row2.posfrom == 5 assert row2.posto == 10
def test_combine(self): rows = screen.col_splitter(3, 0, '0\u0300\u0300\u0300\u0300\u0300\u030012', [1, 0, 0, 0, 0, 0, 0, 1, 1], list(range(9)), [0] * 9, [0] * 9, {}) row1, row2 = rows assert row1.chars == '0\u0300\u0300\u0300\u0300\u0300\u03001' assert row1.cols == [1, 0, 0, 0, 0, 0, 0, 1] assert row1.positions == [0, 1, 2, 3, 4, 5, 6, 7] assert row1.posfrom == 0 assert row1.posto == 8 assert row2.chars == '2' assert row2.cols == [1] assert row2.positions == [8] assert row2.posfrom == 8 assert row2.posto == 9