-
Notifications
You must be signed in to change notification settings - Fork 98
/
test_api.py
37 lines (31 loc) · 1.28 KB
/
test_api.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
import sys
import unittest
import appdirs
if sys.version_info[0] < 3:
STRING_TYPE = basestring
else:
STRING_TYPE = str
class Test_AppDir(unittest.TestCase):
def test_metadata(self):
self.assertTrue(hasattr(appdirs, "__version__"))
self.assertTrue(hasattr(appdirs, "__version_info__"))
def test_helpers(self):
self.assertIsInstance(
appdirs.user_data_dir('MyApp', 'MyCompany'), STRING_TYPE)
self.assertIsInstance(
appdirs.site_data_dir('MyApp', 'MyCompany'), STRING_TYPE)
self.assertIsInstance(
appdirs.user_cache_dir('MyApp', 'MyCompany'), STRING_TYPE)
self.assertIsInstance(
appdirs.user_state_dir('MyApp', 'MyCompany'), STRING_TYPE)
self.assertIsInstance(
appdirs.user_log_dir('MyApp', 'MyCompany'), STRING_TYPE)
def test_dirs(self):
dirs = appdirs.AppDirs('MyApp', 'MyCompany', version='1.0')
self.assertIsInstance(dirs.user_data_dir, STRING_TYPE)
self.assertIsInstance(dirs.site_data_dir, STRING_TYPE)
self.assertIsInstance(dirs.user_cache_dir, STRING_TYPE)
self.assertIsInstance(dirs.user_state_dir, STRING_TYPE)
self.assertIsInstance(dirs.user_log_dir, STRING_TYPE)
if __name__ == "__main__":
unittest.main()