~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: 2009-03-10 05:28:23 UTC
  • mfrom: (4098.1.3 fix-pending-ancestry-keys)
  • Revision ID: pqm@pqm.ubuntu.com-20090310052823-5h4znt0j8j5ak38o
(andrew) Fix a bug with how PendingAncestryResult.get_keys handles
        NULL_REVISION.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1543
1543
        par = _mod_graph.PendingAncestryResult(['rev-2'], repo)
1544
1544
        self.assertEqual(set(['rev-1', 'rev-2']), set(par.get_keys()))
1545
1545
 
 
1546
    def test_get_keys_excludes_null(self):
 
1547
        # Make a 'graph' with an iter_ancestry that returns NULL_REVISION
 
1548
        # somewhere other than the last element, which can happen in real
 
1549
        # ancestries.
 
1550
        class StubGraph(object):
 
1551
            def iter_ancestry(self, keys):
 
1552
                return [(NULL_REVISION, ()), ('foo', (NULL_REVISION,))]
 
1553
        par = _mod_graph.PendingAncestryResult(['rev-3'], None)
 
1554
        par_keys = par._get_keys(StubGraph())
 
1555
        # Only the non-null keys from the ancestry appear.
 
1556
        self.assertEqual(set(['foo']), set(par_keys))
 
1557