poezio/test/test_theming.py
mathieui 70befec8ca
Add some tests
- also fix that travis build
2014-10-29 03:07:40 +01:00

26 lines
537 B
Python

"""
Test the functions in the `theming` module
"""
import sys
import pytest
sys.path.append('src')
from theming import dump_tuple, read_tuple
def test_read_tuple():
assert read_tuple('1,-1,u') == ((1, -1), 'u')
assert read_tuple('1,2') == ((1, 2), None)
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'