-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_wrap.py
More file actions
26 lines (21 loc) · 903 Bytes
/
test_wrap.py
File metadata and controls
26 lines (21 loc) · 903 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
from arrayutilities import Arr
import unittest
class TestArrWrap(unittest.TestCase):
def test_wrap_with_none_value(self):
result = Arr.wrap(None)
expected = []
self.assertEqual(result, expected, "Should return an empty list when the input is None")
def test_wrap_with_single_value(self):
result = Arr.wrap(5)
expected = [5]
self.assertEqual(result, expected, "Should wrap a single value in a list")
def test_wrap_with_list_value(self):
result = Arr.wrap([1, 2, 3])
expected = [1, 2, 3]
self.assertEqual(result, expected, "Should return the original list when input is a list")
def test_wrap_with_string_value(self):
result = Arr.wrap("hello")
expected = ["hello"]
self.assertEqual(result, expected, "Should wrap a string value in a list")
if __name__ == '__main__':
unittest.main()