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)])