]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Use len instead of for-loop to get the end index
authorWu Wenxiang <wu.wenxiang@99cloud.net>
Wed, 19 Feb 2014 13:39:41 +0000 (21:39 +0800)
committerWu Wenxiang <wu.wenxiang@99cloud.net>
Wed, 19 Feb 2014 13:48:05 +0000 (21:48 +0800)
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

cinder/tests/test_backup_tsm.py

index 37d528fcf7c987741fee79792049b2e75dc9983c..2548cbd5e4216683bd9ee2d66ee319115499bb8b 100644 (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]