From 081bb9066bf754aee23489a76f0d5e63bcb4935b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 27 Jun 2017 17:14:47 +1000 Subject: [PATCH] tests: Added format_colors test. --- tests/test_format_colors.py | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 tests/test_format_colors.py diff --git a/tests/test_format_colors.py b/tests/test_format_colors.py new file mode 100755 index 0000000..fab7181 --- /dev/null +++ b/tests/test_format_colors.py @@ -0,0 +1,46 @@ +"""Test format functions.""" +import unittest +from pywal import format_color +from pywal import util + + +# Import colors. +COLORS = util.read_file("tests/test_file") + + +class TestExportColors(unittest.TestCase): + """Test the format_colors functions.""" + + def test_plain(self): + """> Convert colors to plain.""" + result = format_color.plain(COLORS) + self.assertEqual(result[0], "#363442\n") + + def test_shell(self): + """> Convert colors to shell variables.""" + result = format_color.shell(COLORS) + self.assertEqual(result[0], "color0='#363442'\n") + + def test_css(self): + """> Convert colors to css variables.""" + result = format_color.css(COLORS) + self.assertEqual(result[1], "\t--color0: #363442;\n") + + def test_scss(self): + """> Convert colors to scss variables.""" + result = format_color.scss(COLORS) + self.assertEqual(result[0], "$color0: #363442;\n") + + def test_putty(self): + """> Convert colors to putty theme.""" + result = format_color.putty(COLORS) + self.assertEqual(result[2], "\"colour0\"=\"54,52,66\"\n") + + def test_xrdb(self): + """> Convert colors to putty theme.""" + result = format_color.xrdb(COLORS) + self.assertEqual(result[6], "*.color0: #363442\n*color0: #363442\n") + + +if __name__ == "__main__": + unittest.main()