~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-07-08 20:58:10 UTC
  • mto: This revision was merged to the branch mainline in revision 4522.
  • Revision ID: john@arbash-meinel.com-20090708205810-mq7e81jnpccob2qa
Found a bug in the pure-python KnownGraph code.

If a tail is reached directly, we were failing to add it to the possible
tails set. (Uncommon in real-world, but happening in the test suite.)
Just switching the code back to not pre-computing the tail list, same
as we do for the pyrex version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
CompiledKnownGraphFeature = _CompiledKnownGraphFeature()
64
64
 
65
65
 
 
66
#  a
 
67
#  |\
 
68
#  b |
 
69
#  | |
 
70
#  c |
 
71
#   \|
 
72
#    d
 
73
alt_merge = {'a': [], 'b': ['a'], 'c': ['b'], 'd': ['a', 'c']}
 
74
 
 
75
 
66
76
class TestKnownGraph(tests.TestCase):
67
77
 
68
78
    module = None # Set by load_tests
203
213
        self.assertEqual(set(['w', 'q']), graph.heads(['w', 's', 'q']))
204
214
        self.assertEqual(set(['z']), graph.heads(['s', 'z']))
205
215
 
 
216
    def test_heads_alt_merge(self):
 
217
        graph = self.make_known_graph(alt_merge)
 
218
        self.assertEqual(set(['c']), graph.heads(['a', 'c']))
 
219
 
206
220
    def test_heads_with_ghost(self):
207
221
        graph = self.make_known_graph(test_graph.with_ghost)
208
222
        self.assertEqual(set(['e', 'g']), graph.heads(['e', 'g']))