@@ -142,7 +142,7 @@ def test_core(log_path="./examples.log"):
142
142
log (run_dir ())
143
143
log (lib_path ())
144
144
assert_log (this_dir (), lambda x : x .endswith ("MoreBeautifulPython" ))
145
- log (this_dir (go_up = 1 , go_to = "AnotherProject/hello.txt" ))
145
+ log (this_dir (up = 1 , to = "AnotherProject/hello.txt" ))
146
146
assert_log (dir_basename (dir_of (__file__ )), "MoreBeautifulPython" )
147
147
assert_log (file_basename (__file__ ), "examples.py" )
148
148
@@ -213,22 +213,8 @@ def __str__(self):
213
213
long_list = [i for i in range (70 )]
214
214
nested_list = [[[1 , 2 , 3 ], [4 , 5 , 6 ]]]
215
215
multi_lines = "line1\n \t \t - line2\n \t \t - line3\n "
216
- hybrid_list = [
217
- _set ,
218
- _tuple ,
219
- long_list ,
220
- short_list ,
221
- {},
222
- [],
223
- (),
224
- "string" ,
225
- None ,
226
- True ,
227
- False ,
228
- (1 , 2 , 3 ),
229
- nested_list ,
230
- multi_lines ,
231
- ]
216
+ hybrid_list = [_set , _tuple , long_list , short_list , {}, [], (), "string" , None , True , False ,
217
+ (1 , 2 , 3 ), nested_list , multi_lines ]
232
218
hybrid_dict = {
233
219
"hybrid_dict" : hybrid_list ,
234
220
"" : "empty key" ,
@@ -238,6 +224,13 @@ def __str__(self):
238
224
}
239
225
prints (hybrid_dict )
240
226
227
+ # merge() is a recursive dict.update()
228
+ a = {"a" : {"a" : 100 , "b" : [0 ]}}
229
+ b = {"a" : {"b" : 201 , "c" : 301 }}
230
+ c = {"a" : {"c" : 303 }, "c" : [1 , 2 ]}
231
+ assert_log (merge (a , b , c ), {"a" : {"a" : 100 , "b" : 201 , "c" : 303 }, "c" : [1 , 2 ]})
232
+ assert_log (merge (c , b , a ), {"a" : {"a" : 100 , "b" : [0 ], "c" : 301 }, "c" : [1 , 2 ]})
233
+
241
234
# try_f() perform try-except routine and capture the result or error messages in a dictionary
242
235
with enclose (fname (try_f )):
243
236
prints (try_f (sleep_then_maybe_fail , "abc" , fail_p = 1 ))
0 commit comments