コード例 #1
0
 def test_del(self):
     c = instrumented.InstrumentedCache("aninteg", 2, 0)
     c["todelete"] = 42
     self.assertEqual(c["todelete"], 42)
     del c["todelete"]
     with self.assertRaises(KeyError):
         c["todelete"]
コード例 #2
0
 def test_del(self):
     c = instrumented.InstrumentedCache('aninteg', 2, 0)
     c['todelete'] = 42
     self.assertEqual(c['todelete'], 42)
     del c['todelete']
     with self.assertRaises(KeyError):
         c['todelete']
コード例 #3
0
 def test_get_not_exists(self):
     c = instrumented.InstrumentedCache("aninteg", 2, 0)
     with self.assertRaises(KeyError):
         c["akeythatdoesnotexist"]
コード例 #4
0
 def test_get_set(self):
     c = instrumented.InstrumentedCache("aninteg", 2, 0)
     c["lifeuniverseandeverything"] = 42
     self.assertEqual(c["lifeuniverseandeverything"], 42)
コード例 #5
0
 def test_get_set(self):
     c = instrumented.InstrumentedCache('aninteg', 2, 0)
     c['lifeuniverseandeverything'] = 42
     self.assertEqual(c['lifeuniverseandeverything'], 42)