/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

  • Committer: Robert Collins
  • Date: 2008-01-14 23:11:45 UTC
  • mto: This revision was merged to the branch mainline in revision 3181.
  • Revision ID: robertc@robertcollins.net-20080114231145-bv85r8wufwkfm9ee
Review feedback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
691
691
        self.assertRaises(StopIteration, search.next)
692
692
 
693
693
    def test_breadth_first_search_change_next_to_next_with_ghosts(self):
694
 
        # To make the API robust, we allow changing from next() to
695
 
        # next_with_ghosts() and vice verca.
 
694
        # To make the API robust, we allow calling both next() and
 
695
        # next_with_ghosts() on the same searcher.
696
696
        parent_graph = {
697
697
            'head':['present'],
698
698
            'present':['child', 'ghost'],
701
701
        parents_provider = InstrumentedParentsProvider(
702
702
            _mod_graph.DictParentsProvider(parent_graph))
703
703
        graph = _mod_graph.Graph(parents_provider)
704
 
        # with_ghosts reports the ghosts
 
704
        # start with next_with_ghosts
705
705
        search = graph._make_breadth_first_searcher(['head'])
706
706
        self.assertEqual((set(['head']), set()), search.next_with_ghosts())
707
707
        self.assertEqual(set(['present']), search.next())
708
708
        self.assertEqual((set(['child']), set(['ghost'])),
709
709
            search.next_with_ghosts())
710
710
        self.assertRaises(StopIteration, search.next)
711
 
        # next includes them
 
711
        # start with next
712
712
        search = graph._make_breadth_first_searcher(['head'])
713
713
        self.assertEqual(set(['head']), search.next())
714
714
        self.assertEqual((set(['present']), set()), search.next_with_ghosts())
717
717
        self.assertRaises(StopIteration, search.next_with_ghosts)
718
718
 
719
719
    def test_breadth_first_change_search(self):
720
 
        # To make the API robust, we allow changing from next() to
721
 
        # next_with_ghosts() and vice verca.
 
720
        # Changing the search should work with both next and next_with_ghosts.
722
721
        parent_graph = {
723
722
            'head':['present'],
724
723
            'present':['stopped'],