Пример #1
0
 def test_iter(self):
     """ Test that TTLDict can be iterated """
     ttl_dict = TTLDict(60)
     ttl_dict.update(zip(range(10), range(10)))
     self.assertEqual(len(ttl_dict), 10)
     for key in ttl_dict:
         self.assertEqual(key, ttl_dict[key])
Пример #2
0
 def test_update_no_ttl(self):
     """ Test update() call """
     ttl_dict = TTLDict(None)
     orig_dict = {'hello': 'world', 'intval': 3}
     ttl_dict.update(orig_dict)
     self.assertEqual(sorted(orig_dict.items()), sorted(ttl_dict.items()))