Use len instead of for-loop to get the end index

Use len() instead of for-loop to get the end index in file
cinder/tests/test_backup_tsm.py

Change-Id: I3a7b0e418f8af4881e21eb5273a03dbcd317c27d
Closes-Bug: #1282084
This commit is contained in:
Wu Wenxiang 2014-02-19 21:39:41 +08:00
parent a1d78df1b7
commit 38e192afec
1 changed files with 1 additions and 2 deletions

View File

@ -109,8 +109,7 @@ class TSMBackupSimulator:
ret_msg += ('Total number of objects deleted: 1\n'
'Total number of objects failed: 0')
retcode = 0
for idx, backup in enumerate(self._backup_list[path]):
index = idx
index = len(self._backup_list[path]) - 1
del self._backup_list[path][index]
if not len(self._backup_list[path]):
del self._backup_list[path]