Ejemplo n.º 1
0
 def test_popitem(self):
     key = object()
     value = object()
     storage = mock.Mock()
     d = DictDB(storage, {key: value})
     self.assertEquals((key, value), d.popitem())
     storage.delitem.assert_called_with(key)
Ejemplo n.º 2
0
 def test_list_remove(self):
     key = object()
     value = object()
     storage = mock.Mock()
     d = DictDB(storage, {key: [value]})
     d.list_remove(key, value)
     storage.setitem.assert_called_with(key, [])
Ejemplo n.º 3
0
 def test_clear(self):
     key = object()
     value = object()
     storage = mock.Mock()
     d = DictDB(storage, {key: value})
     d.clear()
     self.assertTrue(storage.clear.called)
Ejemplo n.º 4
0
 def test_compact(self):
     key = object()
     value = object()
     storage = mock.Mock()
     stats = storage.compact.return_value
     d = DictDB(storage, {key: value})
     self.assertEquals(stats, d.compact())
     storage.compact.assert_called_with([(key, value)])
Ejemplo n.º 5
0
 def test_db_size(self):
     storage = mock.Mock()
     size = storage.db_size.return_value
     d = DictDB(storage, {})
     self.assertEquals(size, d.db_size())