utils: Add characterisation tests for PathTree
Change-Id: I1ad4832779e85a54a75b3551a8beeba429679e1c
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/obmc/utils/pathtree.py b/obmc/utils/pathtree.py
index 3ca9a7e..da56cfb 100644
--- a/obmc/utils/pathtree.py
+++ b/obmc/utils/pathtree.py
@@ -53,9 +53,9 @@
try:
while True:
x = next(self.it)
- depth_exceeded = len(self.path) + 1 > self.depth
- if self.depth and depth_exceeded:
- continue
+ if self.depth:
+ if len(self.path) + 1 > self.depth:
+ continue
self.itlist.append(self.it)
self.path.append(x[0])
# TODO: openbmc/openbmc#2994 remove python 2 support
@@ -122,7 +122,7 @@
return d[elements[-1]]
def __iter__(self):
- return self
+ return PathTreeItemIterator(self, '/', None)
def __missing__(self, key):
for x in self.iterkeys():