summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-06-27 17:02:42 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-06-27 17:02:42 +1000
commit10c7099a27542d58a66e4fb8d740ec62db2904bf (patch)
tree8b31932c023bed96f841a94d015e645f303922f1 /tests
parentce2d85d5d6ef321b5950d9728ee7204e5724a945 (diff)
tests: Fix comments
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_export_colors.py21
-rwxr-xr-xtests/test_util.py14
2 files changed, 28 insertions, 7 deletions
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")