~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__known_graph.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-16 15:35:14 UTC
  • mto: This revision was merged to the branch mainline in revision 4449.
  • Revision ID: john@arbash-meinel.com-20090616153514-2croj2d8ych1sk71
Clean out some asserts, get rid of the 'dominator_distance' field which isn't used anyway.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
    def make_known_graph(self, ancestry):
72
72
        return self.module.KnownGraph(ancestry, do_cache=self.do_cache)
73
73
 
74
 
    def assertDominator(self, graph, rev, dominator, distance):
 
74
    def assertDominator(self, graph, rev, dominator):
75
75
        node = graph._nodes[rev]
76
76
        self.assertEqual(dominator, node.linear_dominator)
77
 
        self.assertEqual(distance, node.dominator_distance)
78
77
 
79
78
    def assertGDFO(self, graph, rev, gdfo):
80
79
        node = graph._nodes[rev]
91
90
 
92
91
    def test_dominators_ancestry_1(self):
93
92
        graph = self.make_known_graph(test_graph.ancestry_1)
94
 
        self.assertDominator(graph, 'rev1', NULL_REVISION, 1)
95
 
        self.assertDominator(graph, 'rev2b', 'rev2b', 0)
96
 
        self.assertDominator(graph, 'rev2a', 'rev2a', 0)
97
 
        self.assertDominator(graph, 'rev3', 'rev2a', 1)
98
 
        self.assertDominator(graph, 'rev4', 'rev4', 0)
 
93
        self.assertDominator(graph, 'rev1', NULL_REVISION)
 
94
        self.assertDominator(graph, 'rev2b', 'rev2b')
 
95
        self.assertDominator(graph, 'rev2a', 'rev2a')
 
96
        self.assertDominator(graph, 'rev3', 'rev2a')
 
97
        self.assertDominator(graph, 'rev4', 'rev4')
99
98
 
100
99
    def test_dominators_feature_branch(self):
101
100
        graph = self.make_known_graph(test_graph.feature_branch)
102
 
        self.assertDominator(graph, 'rev1', NULL_REVISION, 1)
103
 
        self.assertDominator(graph, 'rev2b', NULL_REVISION, 2)
104
 
        self.assertDominator(graph, 'rev3b', NULL_REVISION, 3)
 
101
        self.assertDominator(graph, 'rev1', NULL_REVISION)
 
102
        self.assertDominator(graph, 'rev2b', NULL_REVISION)
 
103
        self.assertDominator(graph, 'rev3b', NULL_REVISION)
105
104
 
106
105
    def test_dominators_extended_history_shortcut(self):
107
106
        graph = self.make_known_graph(test_graph.extended_history_shortcut)
108
 
        self.assertDominator(graph, 'a', NULL_REVISION, 1)
109
 
        self.assertDominator(graph, 'b', 'b', 0)
110
 
        self.assertDominator(graph, 'c', 'b', 1)
111
 
        self.assertDominator(graph, 'd', 'b', 2)
112
 
        self.assertDominator(graph, 'e', 'e', 0)
113
 
        self.assertDominator(graph, 'f', 'f', 0)
 
107
        self.assertDominator(graph, 'a', NULL_REVISION)
 
108
        self.assertDominator(graph, 'b', 'b')
 
109
        self.assertDominator(graph, 'c', 'b')
 
110
        self.assertDominator(graph, 'd', 'b')
 
111
        self.assertDominator(graph, 'e', 'e')
 
112
        self.assertDominator(graph, 'f', 'f')
114
113
 
115
114
    def test_gdfo_ancestry_1(self):
116
115
        graph = self.make_known_graph(test_graph.ancestry_1)