diff --git a/setup.py b/setup.py index d0729b6..9e22fef 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,6 @@ setup( entry_points={ "console_scripts": ["wal=pywal.__main__:main"] }, - python_requires=">=3.6", + requires_python=">=3.6", test_suite="tests", ) diff --git a/tests/test_export_colors.py b/tests/test_export_colors.py new file mode 100755 index 0000000..ce6fe1e --- /dev/null +++ b/tests/test_export_colors.py @@ -0,0 +1,21 @@ +"""Test util functions.""" +import unittest +import pathlib +from pywal import export_colors +from pywal import util + + +class TestExportColors(unittest.TestCase): + """Test the export_colors functions.""" + + def test_save_colors(self): + """> Export colors to a file.""" + tmp_file = pathlib.Path("/tmp/test_file") + colors = util.read_file("tests/test_file") + export_colors.save_colors(colors, tmp_file, "plain colors") + result = tmp_file.is_file() + self.assertTrue(result) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_util.py b/tests/test_util.py index 3aebc78..0d72f01 100755 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -8,41 +8,41 @@ class TestUtil(unittest.TestCase): """Test the util functions.""" def test_read_file_start(self): - """Test read_file().""" + """> Read colors from a file.""" result = util.read_file("tests/test_file") self.assertEqual(result[0], "#363442") def test_read_file_end(self): - """Test read_file().""" + """> Read colors from a file.""" result = util.read_file("tests/test_file") self.assertEqual(result[15], "#C9CFD0") def test_save_file(self): - """Test save_file().""" + """> Save colors to a file.""" tmp_file = pathlib.Path("/tmp/test_file") util.save_file("Hello, world", tmp_file) result = tmp_file.is_file() self.assertTrue(result) def test_create_dir(self): - """Test create_dir().""" + """> Create a directoru.""" tmp_dir = pathlib.Path("/tmp/test_dir") util.create_dir(tmp_dir) result = tmp_dir.is_dir() self.assertTrue(result) def test_hex_to_rgb_black(self): - """Test hex_to_rgb() on #000000.""" + """> Convert #000000 to RGB.""" result = util.hex_to_rgb("#000000") self.assertEqual(result, "0,0,0") def test_hex_to_rgb_white(self): - """Test hex_to_rgb() on #FFFFFF.""" + """> Convert #FFFFFF to RGB.""" result = util.hex_to_rgb("#FFFFFF") self.assertEqual(result, "255,255,255") def test_hex_to_rgb_rand(self): - """Test hex_to_rgb() on #98AEC2.""" + """> Convert #98AEC2 to RGB.""" result = util.hex_to_rgb("#98AEC2") self.assertEqual(result, "152,174,194")