summaryrefslogtreecommitdiff
path: root/test/test_poopt.py
blob: 54d0c9180de6c0b405c1dcb1b5b51abfd8a42682 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""
Test of the poopt module
"""

import pytest

from poezio.poopt import cut_text

def test_cut_text():

    text = '12345678901234567890'
    assert cut_text(text, 5) == [(0, 5), (5, 10), (10, 15), (15, 20)]

    text = 'a\nb\nc\nd'
    assert cut_text(text, 10) == [(0, 2), (2, 4), (4, 6), (6, 7)]

    text = 'vivent les réfrigérateurs'
    assert cut_text(text, 6) == [(0, 6), (6, 10), (11, 17), (17, 23), (23, 25)]