~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-04-11 16:59:43 UTC
  • mfrom: (5779.1.1 importwarning)
  • Revision ID: pqm@pqm.ubuntu.com-20110411165943-g2uhdcy7zz164e4x
(jelmer) Catch ImportWarning as well when checking for modules in features.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
from bzrlib import (
18
18
    errors,
19
19
    graph as _mod_graph,
20
 
    symbol_versioning,
21
20
    tests,
22
21
    )
23
22
from bzrlib.revision import NULL_REVISION
700
699
        self.assertEqual({'rev2': ['rev1']},
701
700
                         stacked.get_parent_map(['rev2']))
702
701
 
703
 
    def test__stacked_parents_provider_deprecated(self):
704
 
        parents1 = _mod_graph.DictParentsProvider({'rev2': ['rev3']})
705
 
        parents2 = _mod_graph.DictParentsProvider({'rev1': ['rev4']})
706
 
        stacked = self.applyDeprecated(deprecated_in((1, 16, 0)),
707
 
                    _mod_graph._StackedParentsProvider, [parents1, parents2])
708
 
        self.assertEqual({'rev1':['rev4'], 'rev2':['rev3']},
709
 
                         stacked.get_parent_map(['rev1', 'rev2']))
710
 
        self.assertEqual({'rev2':['rev3'], 'rev1':['rev4']},
711
 
                         stacked.get_parent_map(['rev2', 'rev1']))
712
 
        self.assertEqual({'rev2':['rev3']},
713
 
                         stacked.get_parent_map(['rev2', 'rev2']))
714
 
        self.assertEqual({'rev1':['rev4']},
715
 
                         stacked.get_parent_map(['rev1', 'rev1']))
716
 
 
717
702
    def test_iter_topo_order(self):
718
703
        graph = self.make_graph(ancestry_1)
719
704
        args = ['rev2a', 'rev3', 'rev1']
1654
1639
        self.assertEqual(['D'], sorted(graph_thunk.heads(['D', 'C'])))
1655
1640
        self.assertEqual(['B', 'C'], sorted(graph_thunk.heads(['B', 'C'])))
1656
1641
 
 
1642
    def test_add_node(self):
 
1643
        d = {('C',):[('A',)], ('B',): [('A',)], ('A',): []}
 
1644
        g = _mod_graph.KnownGraph(d)
 
1645
        graph_thunk = _mod_graph.GraphThunkIdsToKeys(g)
 
1646
        graph_thunk.add_node("D", ["A", "C"])
 
1647
        self.assertEqual(['B', 'D'],
 
1648
            sorted(graph_thunk.heads(['D', 'B', 'A'])))
 
1649
 
1657
1650
 
1658
1651
class TestPendingAncestryResultGetKeys(TestCaseWithMemoryTransport):
1659
1652
    """Tests for bzrlib.graph.PendingAncestryResult."""