Rev 513: Add simple test for linegraph. in file:///data/jelmer/bzr-gtk/trunk/
Jelmer Vernooij
jelmer at samba.org
Sun Jun 29 16:54:41 BST 2008
At file:///data/jelmer/bzr-gtk/trunk/
------------------------------------------------------------
revno: 513
revision-id: jelmer at samba.org-20080629155440-iuzfrlfifnplp9jq
parent: jelmer at samba.org-20080629154730-xfsotoxwkiytf0ph
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sun 2008-06-29 17:54:40 +0200
message:
Add simple test for linegraph.
added:
tests/test_linegraph.py test_linegraph.py-20080629155407-bytip7n4r8dhg591-1
modified:
branchview/linegraph.py graph.py-20051016214152-ebf565808c860cf7
tests/__init__.py __init__.py-20070201155018-mi2dl3spgj7fqdum-1
=== modified file 'branchview/linegraph.py'
--- a/branchview/linegraph.py 2008-06-29 15:47:30 +0000
+++ b/branchview/linegraph.py 2008-06-29 15:54:40 +0000
@@ -12,8 +12,8 @@
from bzrlib.revision import NULL_REVISION
from bzrlib.tsort import merge_sort
-def linegraph(graph, start_revs, maxnum, broken_line_length = None,
- graph_data = True, mainline_only = False):
+def linegraph(graph, start_revs, maxnum=None, broken_line_length=None,
+ graph_data=True, mainline_only=False):
"""Produce a directed graph of a bzr repository.
Returns a tuple of (line_graph, revid_index, columns_len) where
=== modified file 'tests/__init__.py'
--- a/tests/__init__.py 2007-10-30 21:15:13 +0000
+++ b/tests/__init__.py 2008-06-29 15:54:40 +0000
@@ -27,6 +27,7 @@
testmod_names = [
'test_commit',
'test_diff',
+ 'test_linegraph',
'test_preferences',
'test_history',
]
=== added file 'tests/test_linegraph.py'
--- a/tests/test_linegraph.py 1970-01-01 00:00:00 +0000
+++ b/tests/test_linegraph.py 2008-06-29 15:54:40 +0000
@@ -0,0 +1,45 @@
+# Copyright (C) 2008 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
+
+"""Test the linegraph functionality."""
+
+import os
+
+import gtk
+
+from bzrlib import (
+ graph,
+ tests,
+ )
+from bzrlib.util import bencode
+
+from bzrlib.plugins.gtk.branchview.linegraph import linegraph
+
+
+class TestLinegraph(tests.TestCase):
+ def get_graph(self, dict):
+ return graph.Graph(graph.DictParentsProvider(dict))
+
+ def test_simple(self):
+ lg = linegraph(self.get_graph({"A": ("B", "C"), "B": ()}), ["A"])
+ self.assertEquals(lg,
+ ([
+ ['A', (0, 0), [(0, 0, 0)], ['B'], [], (2,)],
+ ['B', (0, 0), [], (), ['A'], (1,)]
+ ],
+ {'A': 0, 'B': 1},
+ 1))
+
More information about the bazaar-commits
mailing list