-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.py
64 lines (57 loc) · 1.5 KB
/
test.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
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from dict_recursive_update import recursive_update
class Test(unittest.TestCase):
def test_all(self):
self.assertEqual(
recursive_update({
'a': {
'b': 2
}
}, {'a': {
'b': 3,
'd': 4
},
'e': 5}), {'a': {
'b': 3,
'd': 4
},
'e': 5})
self.assertEqual(
recursive_update({
'a': [1]
}, {'a': [2],
'c': {
'd': {
'c': 3
}
}}), {'a': [2],
'c': {
'd': {
'c': 3
}
}})
self.assertEqual(
recursive_update({
'a': {
'c': 1,
'd': {}
},
'b': 4
}, {'b': 5}), {'a': {
'c': 1,
'd': {}
},
'b': 5})
self.assertEqual(
recursive_update({
'a': {
'c': 1,
'd': {}
},
'b': 4
}, {'a': 2}), {'a': 2,
'b': 4})
if __name__ == '__main__':
unittest.main()