2014-10-27 19:01:22 +00:00
|
|
|
"""
|
|
|
|
Test of the poopt module
|
|
|
|
"""
|
|
|
|
|
2016-08-21 13:39:46 +00:00
|
|
|
from poezio.poopt import cut_text
|
2014-10-27 19:01:22 +00:00
|
|
|
|
|
|
|
def test_cut_text():
|
|
|
|
|
|
|
|
text = '12345678901234567890'
|
|
|
|
assert cut_text(text, 5) == [(0, 5), (5, 10), (10, 15), (15, 20)]
|
2017-10-11 21:06:57 +00:00
|
|
|
|
|
|
|
text = 'a\nb\nc\nd'
|
|
|
|
assert cut_text(text, 10) == [(0, 2), (2, 4), (4, 6), (6, 7)]
|
2017-10-11 22:17:09 +00:00
|
|
|
|
|
|
|
text = 'vivent les réfrigérateurs'
|
|
|
|
assert cut_text(text, 6) == [(0, 6), (6, 10), (11, 17), (17, 23), (23, 25)]
|