2014-10-29 02:04:34 +00:00
|
|
|
"""
|
|
|
|
Test the functions in the `theming` module
|
|
|
|
"""
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import pytest
|
2016-03-31 17:54:41 +00:00
|
|
|
sys.path.append('poezio')
|
2014-10-29 02:04:34 +00:00
|
|
|
|
|
|
|
from theming import dump_tuple, read_tuple
|
|
|
|
|
|
|
|
def test_read_tuple():
|
|
|
|
assert read_tuple('1,-1,u') == ((1, -1), 'u')
|
2016-06-12 14:56:18 +00:00
|
|
|
assert read_tuple('1,2') == ((1, 2), '\0')
|
2014-10-29 02:04:34 +00:00
|
|
|
|
|
|
|
with pytest.raises(IndexError):
|
|
|
|
read_tuple('1')
|
|
|
|
|
|
|
|
with pytest.raises(ValueError):
|
|
|
|
read_tuple('toto')
|
|
|
|
|
|
|
|
def test_dump_tuple():
|
|
|
|
assert dump_tuple((1, 2)) == '1,2'
|
|
|
|
assert dump_tuple((1, )) == '1'
|
|
|
|
assert dump_tuple((1, 2, 'u')) == '1,2,u'
|
|
|
|
|
|
|
|
|