~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_graph.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-06-21 17:27:28 UTC
  • mfrom: (5988.1.3 thunk-merge-sort)
  • Revision ID: pqm@pqm.ubuntu.com-20110621172728-3203vaenqctilpd7
(jelmer) Fix the thunking of GraphThunkIdsToKeys.merge_sort. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1646
1646
        self.assertEqual(['B', 'D'],
1647
1647
            sorted(graph_thunk.heads(['D', 'B', 'A'])))
1648
1648
 
 
1649
    def test_merge_sort(self):
 
1650
        d = {('C',):[('A',)], ('B',): [('A',)], ('A',): []}
 
1651
        g = _mod_graph.KnownGraph(d)
 
1652
        graph_thunk = _mod_graph.GraphThunkIdsToKeys(g)
 
1653
        graph_thunk.add_node("D", ["A", "C"])
 
1654
        self.assertEqual([('C', 0, (2,), False), ('A', 0, (1,), True)],
 
1655
            [(n.key, n.merge_depth, n.revno, n.end_of_merge)
 
1656
                 for n in graph_thunk.merge_sort('C')])
 
1657
 
1649
1658
 
1650
1659
class TestPendingAncestryResultGetKeys(TestCaseWithMemoryTransport):
1651
1660
    """Tests for bzrlib.graph.PendingAncestryResult."""