From b0c524e5a80056cdcdb79b7b53079fc2f63dd0dd Mon Sep 17 00:00:00 2001 From: Wirawan Purwanto Date: Thu, 5 Jun 2014 12:47:44 -0400 Subject: [PATCH] * Added more test harness (test 3) for dict_update_nested(). --- test_sugar.py | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/test_sugar.py b/test_sugar.py index e468cfd..85621de 100644 --- a/test_sugar.py +++ b/test_sugar.py @@ -8,6 +8,7 @@ def def_dict_data1(): """ global DN1, DN2 global DN1_orig, DN2_orig + global DN3, DN3_orig DN1 = { 'A': 'executive', 'B': { @@ -42,6 +43,16 @@ def def_dict_data1(): }, } DN2_orig = deepcopy(DN2) + DN3 = { + 'C': { + 'properties': dict( + nest1 = { + 3: 4021, + }, + ), + }, + } + DN3_orig = deepcopy(DN3) @@ -130,6 +141,31 @@ def test_dict_update_nested2(): pprint(DN2) + +def test_dict_update_nested3(): + """[20140605] + """ + from wpylib.sugar import dict_update_nested + def_dict_data1() + DN1 = deepcopy(DN1_orig) + DN3 = deepcopy(DN3_orig) + + print "test_dict_update_nested3():" + print "DN1:" + pprint(DN1) + + print + print "DN3:" + pprint(DN3) + + print + print "Update DN1 with DN3, nested:..." + dict_update_nested(DN1, DN3) + pprint(DN1) + + + + if __name__ == "__main__": - test_dict_update_nested1() + test_dict_update_nested3()