diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-06-27 17:24:27 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-06-27 17:24:27 +1000 |
| commit | 790ab71c50ad4d7e695d4e868933363c4be090fa (patch) | |
| tree | ea69ee248f13e15a849afe2c176947c10a364172 /tests | |
| parent | 081bb9066bf754aee23489a76f0d5e63bcb4935b (diff) | |
tests: Added set_colors tests.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/test_export_colors.py | 5 | ||||
| -rwxr-xr-x | tests/test_format_colors.py | 3 | ||||
| -rwxr-xr-x | tests/test_set_colors.py | 32 | ||||
| -rwxr-xr-x | tests/test_util.py | 1 |
4 files changed, 40 insertions, 1 deletions
diff --git a/tests/test_export_colors.py b/tests/test_export_colors.py index ce6fe1e..5680dfc 100755 --- a/tests/test_export_colors.py +++ b/tests/test_export_colors.py @@ -1,10 +1,15 @@ """Test util functions.""" import unittest import pathlib + from pywal import export_colors from pywal import util +# Import colors. +COLORS = util.read_file("tests/test_file") + + class TestExportColors(unittest.TestCase): """Test the export_colors functions.""" diff --git a/tests/test_format_colors.py b/tests/test_format_colors.py index fab7181..ecee336 100755 --- a/tests/test_format_colors.py +++ b/tests/test_format_colors.py @@ -1,5 +1,6 @@ """Test format functions.""" import unittest + from pywal import format_color from pywal import util @@ -8,7 +9,7 @@ from pywal import util COLORS = util.read_file("tests/test_file") -class TestExportColors(unittest.TestCase): +class TestFormatColors(unittest.TestCase): """Test the format_colors functions.""" def test_plain(self): diff --git a/tests/test_set_colors.py b/tests/test_set_colors.py new file mode 100755 index 0000000..5ff6b5c --- /dev/null +++ b/tests/test_set_colors.py @@ -0,0 +1,32 @@ +"""Test set functions.""" +import unittest + +from pywal import set_colors +from pywal import util + + +# Import colors. +COLORS = util.read_file("tests/test_file") + + +class TestSetColors(unittest.TestCase): + """Test the format_colors functions.""" + + def test_set_special(self): + """> Create special escape sequence.""" + result = set_colors.set_special(11, COLORS[0]) + self.assertEqual(result, "\x1b]11;#363442\x07") + + def test_set_color(self): + """> Create color escape sequence.""" + result = set_colors.set_color(11, COLORS[0]) + self.assertEqual(result, "\033]4;11;#363442\007") + + def test_set_grey(self): + """> Create special escape sequence.""" + result = set_colors.set_grey(COLORS) + self.assertEqual(result, "#999999") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_util.py b/tests/test_util.py index 0d72f01..6aeef9b 100755 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,6 +1,7 @@ """Test util functions.""" import unittest import pathlib + from pywal import util |
