From e260fa7ed1e501404c75cdbe3d7461f29cd6c3e1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 5 Dec 2009 08:08:09 -0500 Subject: Adjust libbe.diff.DiffTree to fix failed doctest. ====================================================================== FAIL: Doctest: libbe.diff.DiffTree ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.5/doctest.py", line 2128, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for libbe.diff.DiffTree File "/home/wking/src/fun/be/be.diff-subscribe/libbe/diff.py", line 136, in DiffTree ---------------------------------------------------------------------- File "/home/wking/src/fun/be/be.diff-subscribe/libbe/diff.py", line 172, in libbe.diff.DiffTree Failed example: print bugdir.report_string() Exception raised: Traceback (most recent call last): File "/usr/lib/python2.5/doctest.py", line 1228, in __run compileflags, 1) in test.globs File "", line 1, in print bugdir.report_string() File "/home/wking/src/fun/be/be.diff-subscribe/libbe/diff.py", line 213, in report_string return "\n".join(self.report()) TypeError --- libbe/diff.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libbe') diff --git a/libbe/diff.py b/libbe/diff.py index 46b8bda..b3cd6bc 100644 --- a/libbe/diff.py +++ b/libbe/diff.py @@ -210,12 +210,15 @@ class DiffTree (tree.Tree): raise KeyError, "%s doesn't match '%s'" % (names, self.name) raise KeyError, "%s points to child not in %s" % (names, [c.name for c in self]) def report_string(self): - return "\n".join(self.report()) + report = self.report() + if report == None: + return '' + return '\n'.join(report) def report(self, root=None, parent=None, depth=0): if root == None: root = self.make_root() if self.masked == True: - return None + return root data_part = self.data_part(depth) if self.requires_children == True \ and len([c for c in self if c.masked == False]) == 0: -- cgit