2017-06-27 09:24:27 +02:00
|
|
|
"""Test set functions."""
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
from pywal import set_colors
|
|
|
|
from pywal import util
|
|
|
|
|
|
|
|
|
|
|
|
# Import colors.
|
2017-06-29 04:15:41 +02:00
|
|
|
COLORS = util.read_file_json("tests/test_files/test_file.json")
|
2017-06-27 09:24:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
class TestSetColors(unittest.TestCase):
|
2017-06-27 09:30:31 +02:00
|
|
|
"""Test the set_colors functions."""
|
2017-06-27 09:24:27 +02:00
|
|
|
|
|
|
|
def test_set_special(self):
|
|
|
|
"""> Create special escape sequence."""
|
2017-06-29 04:15:41 +02:00
|
|
|
result = set_colors.set_special(11, COLORS["special"]["background"])
|
|
|
|
self.assertEqual(result, "\x1b]11;#3A5130\x07")
|
2017-06-27 09:24:27 +02:00
|
|
|
|
|
|
|
def test_set_color(self):
|
|
|
|
"""> Create color escape sequence."""
|
2017-06-29 04:15:41 +02:00
|
|
|
result = set_colors.set_color(11, COLORS["colors"]["color0"])
|
|
|
|
self.assertEqual(result, "\033]4;11;#3A5130\007")
|
2017-06-27 09:24:27 +02:00
|
|
|
|
|
|
|
def test_set_grey(self):
|
|
|
|
"""> Create special escape sequence."""
|
2017-06-29 04:15:41 +02:00
|
|
|
colors = [list(COLORS["colors"].values())]
|
|
|
|
result = set_colors.set_grey(colors[0])
|
2017-06-27 09:24:27 +02:00
|
|
|
self.assertEqual(result, "#999999")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|