From 790ab71c50ad4d7e695d4e868933363c4be090fa Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 27 Jun 2017 17:24:27 +1000 Subject: tests: Added set_colors tests. --- setup.py | 2 +- tests/test_export_colors.py | 5 +++++ tests/test_format_colors.py | 3 ++- tests/test_set_colors.py | 32 ++++++++++++++++++++++++++++++++ tests/test_util.py | 1 + 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100755 tests/test_set_colors.py diff --git a/setup.py b/setup.py index 9e22fef..d0729b6 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,6 @@ setup( entry_points={ "console_scripts": ["wal=pywal.__main__:main"] }, - requires_python=">=3.6", + python_requires=">=3.6", test_suite="tests", ) 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 -- cgit v1.2.3