[Pkg-bazaar-commits] ./bzr-gtk/unstable r198: Add tests for DummyRevision.

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:45:34 UTC 2009


------------------------------------------------------------
revno: 198
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2007-05-19 17:15:11 +0100
message:
  Add tests for DummyRevision.
added:
  tests/test_viz.py
modified:
  tests/__init__.py
  viz/graph.py
-------------- next part --------------
=== modified file 'tests/__init__.py'
--- a/tests/__init__.py	2007-03-23 12:46:47 +0000
+++ b/tests/__init__.py	2007-05-19 16:15:11 +0000
@@ -27,6 +27,7 @@
     testmod_names = [
         'test_preferences',
         'test_history',
+        'test_viz'
         ]
 
     if os.name == 'nt':

=== added file 'tests/test_viz.py'
--- a/tests/test_viz.py	1970-01-01 00:00:00 +0000
+++ b/tests/test_viz.py	2007-05-19 16:15:11 +0000
@@ -0,0 +1,27 @@
+# Copyright (C) 2007 Jelmer Vernooij <jelmer at samba.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from bzrlib.plugins.gtk.viz.graph import DummyRevision
+from bzrlib.tests import TestCase
+
+class TestDummyRevision(TestCase):
+    def test_dummy_revision(self):
+        d = DummyRevision("blarev")
+        self.assertEquals("blarev", d.revision_id)
+        self.assertEquals({}, d.properties)
+        self.assertIs(None, d.committer)
+        self.assertIs(None, d.timestamp)
+        self.assertIs(None, d.timezone)

=== modified file 'viz/graph.py'
--- a/viz/graph.py	2007-05-19 09:58:19 +0000
+++ b/viz/graph.py	2007-05-19 16:15:11 +0000
@@ -10,10 +10,11 @@
 __author__    = "Scott James Remnant <scott at ubuntu.com>"
 
 
+from bzrlib.revision import Revision
 from bzrlib.tsort import merge_sort
 
 
-class DummyRevision(object):
+class DummyRevision(Revision):
     """Dummy bzr revision.
 
     Sometimes, especially in older bzr branches, a revision is referenced
@@ -21,15 +22,10 @@
     When this happens we use an instance of this class instead of the real
     Revision object (which we can't get).
     """
-
     def __init__(self, revid):
-        self.revision_id = revid
-        self.parent_ids = []
+        super(DummyRevision, self).__init__(revid)
         self.committer = None
-        self.timestamp = None
-        self.timezone = None
-        self.message = self.revision_id
-        self.properties = {}
+        self.message = revid
 
 
 class RevisionProxy(object):



More information about the Pkg-bazaar-commits mailing list