/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_graph.py

Merge from mbp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from bzrlib.selftest import TestCase
 
1
from bzrlib.tests import TestCase
2
2
from bzrlib.graph import node_distances, nodes_by_distance
3
3
 
4
4
class TestBase(TestCase):
33
33
        distances = node_distances(self.graph, descendants, 'A')
34
34
        nodes = nodes_by_distance(distances)
35
35
        self.assertEqual(nodes[0], 'D')
36
 
        assert nodes[1] in ('N', 'C')
37
 
        assert nodes[2] in ('N', 'C')
38
 
        assert nodes[3] in ('B', 'M')
39
 
        assert nodes[4] in ('B', 'M')
 
36
        self.assert_(nodes[1] in ('N', 'C'))
 
37
        self.assert_(nodes[2] in ('N', 'C'))
 
38
        self.assert_(nodes[3] in ('B', 'M'))
 
39
        self.assert_(nodes[4] in ('B', 'M'))
40
40
 
 
41
        #Ensure we don't shortcut through B when there's only a difference of
 
42
        # 1 in distance
 
43
        self.graph = {}
 
44
        self.edge_add('A', 'B', 'C')
 
45
        self.edge_add('A', 'D', 'E', 'C')
 
46
        descendants = self.node_descendants()
 
47
        distances = node_distances(self.graph, descendants, 'A')
 
48
        self.assertEqual(distances['C'], 3)
41
49