~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_index.py

  • Committer: Robert Collins
  • Date: 2007-07-13 16:35:54 UTC
  • mto: (2592.3.3 repository)
  • mto: This revision was merged to the branch mainline in revision 2624.
  • Revision ID: robertc@robertcollins.net-20070713163554-ok2qtnzv6rcbpt3z
Change the missing key interface in index operations to not raise, allowing callers to set policy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
256
256
            set(index.iter_all_entries()))
257
257
        self.assertEqual(set([('name', (('ref',),), 'data')]),
258
258
            set(index.iter_entries(['name'])))
259
 
        self.assertRaises(errors.MissingKey, list, index.iter_entries(['ref']))
 
259
        self.assertEqual([], list(index.iter_entries(['ref'])))
260
260
 
261
261
    def test_iter_all_keys(self):
262
262
        index = self.make_index(1, nodes=[
272
272
 
273
273
    def test_iter_missing_entry_empty(self):
274
274
        index = self.make_index()
275
 
        self.assertRaises(errors.MissingKey, list, index.iter_entries(['a']))
 
275
        self.assertEqual([], list(index.iter_entries(['a'])))
276
276
 
277
277
    def test_validate_bad_index_errors(self):
278
278
        trans = self.get_transport()
392
392
 
393
393
    def test_iter_missing_entry_empty(self):
394
394
        index = CombinedGraphIndex([])
395
 
        self.assertRaises(errors.MissingKey, list, index.iter_entries(['a']))
 
395
        self.assertEqual([], list(index.iter_entries(['a'])))
396
396
 
397
397
    def test_iter_missing_entry_one_index(self):
398
398
        index1 = self.make_index('1')
399
399
        index = CombinedGraphIndex([index1])
400
 
        self.assertRaises(errors.MissingKey, list, index.iter_entries(['a']))
 
400
        self.assertEqual([], list(index.iter_entries(['a'])))
401
401
 
402
402
    def test_iter_missing_entry_two_index(self):
403
403
        index1 = self.make_index('1')
404
404
        index2 = self.make_index('2')
405
405
        index = CombinedGraphIndex([index1, index2])
406
 
        self.assertRaises(errors.MissingKey, list, index.iter_entries(['a']))
 
406
        self.assertEqual([], list(index.iter_entries(['a'])))
407
407
 
408
408
    def test_iter_entry_present_one_index_only(self):
409
409
        index1 = self.make_index('1', nodes=[('key', (), '')])