forked from vongostev/202-Advanced-Python-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_solid3.py
More file actions
33 lines (23 loc) · 863 Bytes
/
test_solid3.py
File metadata and controls
33 lines (23 loc) · 863 Bytes
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
import unittest
from solid3 import *
class TestCheckPath(unittest.TestCase):
def test_positive_str(self):
str_test = './test0.yaml'
self.assertEqual(check_path(str_test), Path(str_test))
def test_positive_path(self):
path_test = Path('./test0.yaml')
self.assertEqual(check_path(path_test), path_test)
def test_exception_filenotfound(self):
with self.assertRaises(FileNotFoundError):
check_path('1')
def test_exception_directory(self):
with self.assertRaises(EnvironmentError):
check_path('.')
def test_exception_emptystr(self):
with self.assertRaises(ValueError):
check_path('')
def test_exception_wrongtype(self):
with self.assertRaises(AssertionError):
check_path(10)
if __name__ == "__main__":
unittest.main()