~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lru_cache.py

  • Committer: Rory Yorke
  • Date: 2010-10-20 14:38:53 UTC
  • mto: This revision was merged to the branch mainline in revision 5519.
  • Revision ID: rory.yorke@gmail.com-20101020143853-9kfd2ldcjfroh8jw
Show missing files in bzr status (bug 134168).

"bzr status" will now show missing files, that is, those added with "bzr
add" and then removed by non bzr means (e.g., rm).

Blackbox tests were added for this case, and tests were also added to
test_delta, since the implementation change is in bzrlib.delta.

Might also affect bug 189709.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    def test_missing(self):
39
39
        cache = lru_cache.LRUCache(max_cache=10)
40
40
 
41
 
        self.assertFalse('foo' in cache)
 
41
        self.failIf('foo' in cache)
42
42
        self.assertRaises(KeyError, cache.__getitem__, 'foo')
43
43
 
44
44
        cache['foo'] = 'bar'
45
45
        self.assertEqual('bar', cache['foo'])
46
 
        self.assertTrue('foo' in cache)
47
 
        self.assertFalse('bar' in cache)
 
46
        self.failUnless('foo' in cache)
 
47
        self.failIf('bar' in cache)
48
48
 
49
49
    def test_map_None(self):
50
50
        # Make sure that we can properly map None as a key.
51
51
        cache = lru_cache.LRUCache(max_cache=10)
52
 
        self.assertFalse(None in cache)
 
52
        self.failIf(None in cache)
53
53
        cache[None] = 1
54
54
        self.assertEqual(1, cache[None])
55
55
        cache[None] = 2
75
75
        # With a max cache of 1, adding 'baz' should pop out 'foo'
76
76
        cache['baz'] = 'biz'
77
77
 
78
 
        self.assertFalse('foo' in cache)
79
 
        self.assertTrue('baz' in cache)
 
78
        self.failIf('foo' in cache)
 
79
        self.failUnless('baz' in cache)
80
80
 
81
81
        self.assertEqual('biz', cache['baz'])
82
82
 
92
92
        # This must kick out 'foo' because it was the last accessed
93
93
        cache['nub'] = 'in'
94
94
 
95
 
        self.assertFalse('foo' in cache)
 
95
        self.failIf('foo' in cache)
96
96
 
97
97
    def test_cleanup(self):
98
98
        """Test that we can use a cleanup function."""