forked from zero-to-mastery/ascii-art
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
53 lines (39 loc) · 1.54 KB
/
tests.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import unittest
import sys
from PIL import Image
import importlib
sys.path.insert(1,'../')
community_file = importlib.import_module('community-version', None)
class Testing(unittest.TestCase):
def test_1_colorText(self):
text = 'test'
def_output = community_file.colorText(text)
self.assertIs(type(def_output), str)
def test_2_is_supported(self):
path = '../ztm-logo.png'
def_output = community_file.is_supported(path)
self.assertTrue(def_output)
def test_3_is_supported(self):
bad_path = '.ztm-logo'
def_output = community_file.is_supported(bad_path)
self.assertFalse(def_output)
def test_4_check_file(self):
path = '../ztm-logo.png'
def_output = community_file.check_file(path)
self.assertIsNone(def_output)
def test_5_write_file(self):
def_output = community_file.write_file('test','test')
self.assertTrue(def_output)
def test_6_write_file(self):
def_output = community_file.write_file('','test')
self.assertFalse(def_output)
def test_7_write_file(self):
self.assertRaises(TypeError, lambda: community_file.write_file(''))
def test_8_output_name(self):
self.assertIs(type(community_file.output_name('test')), str)
def test_9_output_name(self):
self.assertRaises(TypeError, lambda: community_file.output_name())
def test_10_all_supported_files(self):
self.assertIs(type(community_file.all_supported_files()),list)
if __name__ == '__main__':
unittest.main()