From 70befec8cad1633baee30530e353bca5da9b8d32 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 29 Oct 2014 03:04:34 +0100 Subject: Add some tests - also fix that travis build --- test/test_theming.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/test_theming.py (limited to 'test/test_theming.py') diff --git a/test/test_theming.py b/test/test_theming.py new file mode 100644 index 00000000..9cdb4829 --- /dev/null +++ b/test/test_theming.py @@ -0,0 +1,26 @@ +""" +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' + + -- cgit v1.2.3