forked from dylanaraps/pywal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_image.py
31 lines (23 loc) · 896 Bytes
/
test_image.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""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.assertIn("tests/test_files/test.jpg", result)
def test_get_img_dir(self):
"""> Validate image directory."""
result = image.get("tests/test_files")
self.assertEqual(result.endswith((".jpg", ".png")), 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()