Fix simplifiable-range pylint warnings.

This commit is contained in:
Ned Batchelder
2015-05-30 11:18:58 -04:00
parent 5b6294fe23
commit cc5c1001d1
21 changed files with 54 additions and 55 deletions

View File

@@ -273,11 +273,11 @@ class TestCourseListing(ModuleStoreTestCase):
num_courses_to_create = 3
courses = [
self._create_course_with_access_groups(CourseLocator('Org', 'CreatedCourse' + str(num), 'Run'), self.user)
for num in range(0, num_courses_to_create)
for num in range(num_courses_to_create)
]
courses_in_progress = [
self._create_course_with_access_groups(CourseLocator('Org', 'InProgressCourse' + str(num), 'Run'), self.user)
for num in range(0, num_courses_to_create)
for num in range(num_courses_to_create)
]
# simulate initiation of course actions

View File

@@ -58,7 +58,7 @@ COURSE_CHILD_STRUCTURE = {
def create_children(store, parent, category, load_factor):
""" create load_factor children within the given parent; recursively call to insert children when appropriate """
created_count = 0
for child_index in range(0, load_factor):
for child_index in range(load_factor):
child_object = ItemFactory.create(
parent_location=parent.location,
category=category,

View File

@@ -144,7 +144,7 @@ class TestLibraries(LibraryTestCase):
"""
Test the 'max_count' property of LibraryContent blocks.
"""
for _ in range(0, num_to_create):
for _ in range(num_to_create):
self._add_simple_content_block()
with modulestore().default_store(ModuleStoreEnum.Type.split):
@@ -168,7 +168,7 @@ class TestLibraries(LibraryTestCase):
Test that the same student will always see the same selected child block
"""
# Create many blocks in the library and add them to a course:
for num in range(0, 8):
for num in range(8):
ItemFactory.create(
data="This is #{}".format(num + 1),
category="html", parent_location=self.library.location, user_id=self.user.id, publish_item=False
@@ -202,7 +202,7 @@ class TestLibraries(LibraryTestCase):
"""
Confirm that chosen_child is still the child seen by the test student
"""
for _ in range(0, 6): # Repeat many times b/c blocks are randomized
for _ in range(6): # Repeat many times b/c blocks are randomized
lc_block = modulestore().get_item(lc_block_key) # Reload block from the database
self._bind_module(lc_block)
current_child = get_child_of_lc_block(lc_block)

View File

@@ -124,7 +124,7 @@ class HelperMethods(object):
i, 'Name ' + str(i), 'Description ' + str(i),
[Group(0, 'Group A'), Group(1, 'Group B'), Group(2, 'Group C')],
scheme=None, scheme_id=scheme_id
) for i in xrange(0, count)
) for i in xrange(count)
]
self.course.user_partitions = partitions
self.save_course()

View File

@@ -51,7 +51,7 @@ class UnitTestLibraries(ModuleStoreTestCase):
Test that we can GET /library/ to list all libraries visible to the current user.
"""
# Create some more libraries
libraries = [LibraryFactory.create() for _ in range(0, 3)]
libraries = [LibraryFactory.create() for _ in range(3)]
lib_dict = dict([(lib.location.library_key, lib) for lib in libraries])
response = self.client.get_json(LIBRARY_REST_URL)