예제 #1
0
    def test_same_key(self):
        d = RecentlyUsedContainer(5)

        for i in xrange(10):
            d['foo'] = i

        self.assertEqual(d.keys(), ['foo'])

        d._prune_invalidated_entries()

        self.assertEqual(len(d.access_log), 1)
예제 #2
0
    def test_same_key(self):
        d = RecentlyUsedContainer(5)

        for i in xrange(10):
            d['foo'] = i

        self.assertEqual(d.keys(), ['foo'])

        d._prune_invalidated_entries()

        self.assertEqual(len(d.access_log), 1)
예제 #3
0
    def test_expire(self):
        d = RecentlyUsedContainer(5)

        for i in xrange(5):
            d[i] = str(i)

        for i in xrange(5):
            d.get(0)

        # Add one more entry
        d[5] = '5'

        # Check state
        self.assertEqual(d.keys(), [0, 2, 3, 4, 5])
예제 #4
0
    def test_expire(self):
        d = RecentlyUsedContainer(5)

        for i in xrange(5):
            d[i] = str(i)

        for i in xrange(5):
            d.get(0)

        # Add one more entry
        d[5] = '5'

        # Check state
        self.assertEqual(d.keys(), [0, 2, 3, 4, 5])