From: W. Trevor King Date: Wed, 29 Aug 2012 13:44:37 +0000 (-0400) Subject: bug: add doctest for Bug.xml(). X-Git-Tag: 1.1.0~116 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3ef47dbe8fbd0161c3f4dd6d75a91fd2154a8f27;p=be.git bug: add doctest for Bug.xml(). --- diff --git a/libbe/bug.py b/libbe/bug.py index 7cf1bf8..d77c8c3 100644 --- a/libbe/bug.py +++ b/libbe/bug.py @@ -317,6 +317,60 @@ class Bug (settings_object.SavedSettingsObject): return output def xml(self, indent=0, show_comments=False): + """ + >>> bugA = Bug(uuid='0123', summary='Need to test Bug.xml()') + >>> bugA.uuid = 'bugA' + >>> bugA.time_string = 'Thu, 01 Jan 1970 00:00:00 +0000' + >>> bugA.creator = u'Frank' + >>> bugA.extra_strings += ['TAG: very helpful'] + >>> commA = bugA.comment_root.new_reply(body='comment A') + >>> commA.uuid = 'commA' + >>> commA.date = 'Thu, 01 Jan 1970 00:01:00 +0000' + >>> commB = commA.new_reply(body='comment B') + >>> commB.uuid = 'commB' + >>> commB.date = 'Thu, 01 Jan 1970 00:02:00 +0000' + >>> commC = commB.new_reply(body='comment C') + >>> commC.uuid = 'commC' + >>> commC.date = 'Thu, 01 Jan 1970 00:03:00 +0000' + >>> xml = bugA.xml(show_comments=True) + >>> print(xml) # doctest: +REPORT_UDIFF + + bugA + /bug + minor + open + Frank + Thu, 01 Jan 1970 00:00:00 +0000 + Need to test Bug.xml() + TAG: very helpful + + commA + /bug/commA + + Thu, 01 Jan 1970 00:01:00 +0000 + text/plain + comment A + + + commB + /bug/commB + commA + + Thu, 01 Jan 1970 00:02:00 +0000 + text/plain + comment B + + + commC + /bug/commC + commB + + Thu, 01 Jan 1970 00:03:00 +0000 + text/plain + comment C + + + """ if self.time == None: timestring = "" else: