From 01089dd6774c1ce4735e4ef363464082b24ce3eb Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Tue, 28 Jan 2014 23:19:16 +0000 Subject: [PATCH] Added unit test for accumulateLeaves --- bin/weeutil/weeutil.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/weeutil/weeutil.py b/bin/weeutil/weeutil.py index a4177bb1..0b369003 100644 --- a/bin/weeutil/weeutil.py +++ b/bin/weeutil/weeutil.py @@ -37,6 +37,12 @@ def accumulateLeaves(d): then having them overridden in the leaf nodes of a ConfigObj. d: instance of a configobj.Section (i.e., a section of a ConfigObj) + + Example: Supply a default color=blue, size=10. The section "dayimage" overrides the former: + + >>> c = configobj.ConfigObj({"color":"blue", "size":10, "dayimage":{"color":"red"}}); + >>> print accumulateLeaves(c["dayimage"]) + {'color': 'red', 'size': 10} """ # Use recursion. If I am the root object, then there is nothing above