mirror of
https://github.com/dylanaraps/pywal.git
synced 2024-11-25 17:33:09 +01:00
32 lines
889 B
Python
32 lines
889 B
Python
"""Test image functions."""
|
|
import unittest
|
|
|
|
from pywal import image
|
|
|
|
|
|
class TestImage(unittest.TestCase):
|
|
"""Test image functions."""
|
|
def test_get_img(self):
|
|
"""> Validate image file."""
|
|
result = image.get("tests/test_files/test.jpg")
|
|
self.assertEqual(result, "tests/test_files/test.jpg")
|
|
|
|
def test_get_img_dir(self):
|
|
"""> Validate image directory."""
|
|
result = image.get("tests/test_files")
|
|
self.assertEqual(result.endswith(".jpg"), True)
|
|
|
|
def test_get_img_fail(self):
|
|
"""> Validate image file. (fail)"""
|
|
with self.assertRaises(SystemExit):
|
|
image.get("tests/test_files/test_fail.jpg")
|
|
|
|
def test_get_img_dir_fail(self):
|
|
"""> Validate image directory. (fail)"""
|
|
with self.assertRaises(SystemExit):
|
|
image.get("tests")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|