Beispiel #1
0
    def test_keys(self):
        c = InMemoryCache()
        c.set('some_key1', 'some_value1')
        c.set('some_key2', 'some_value2')
        c.set('some_key3', 'some_value3')

        values = c.keys('some_key*')
        self.assertEqual(values, ['some_key1', 'some_key3', 'some_key2'])
Beispiel #2
0
 def test_set(self):
     c = InMemoryCache()
     c.set('some_key', 'some_value')
     self.assert_cache(c)
Beispiel #3
0
 def test_delete(self):
     c = InMemoryCache()
     c.set('some_key', 'some_value')
     self.assert_cache(c)
     c.delete('some_key')
     self.assertEqual(c.get('some_key'), None)
Beispiel #4
0
 def test_get(self):
     c = InMemoryCache()
     c.set('some_key', 'some_value')
     self.assertEqual(c.get('some_key'), 'some_value')
     self.assert_cache(c)