-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_accessible.py
More file actions
23 lines (17 loc) · 818 Bytes
/
test_accessible.py
File metadata and controls
23 lines (17 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import unittest
from arrayutilities import Arr
from collections import UserDict
class TestArr(unittest.TestCase):
def test_accessible_with_list(self):
self.assertTrue(Arr.accessible([]), "Should be True for lists")
def test_accessible_with_dict(self):
self.assertTrue(Arr.accessible({}), "Should be True for dicts")
def test_accessible_with_userdict(self):
self.assertTrue(Arr.accessible(UserDict()), "Should be True for UserDict")
def test_accessible_with_int(self):
self.assertFalse(Arr.accessible(123), "Should be False for integers")
def test_accessible_with_string(self):
self.assertFalse(Arr.accessible("hello"), "Should be False for strings")
# This allows the test to be run from the command line
if __name__ == '__main__':
unittest.main()