Removed uneeded iter() calls with generator expression as argument.
This commit is contained in:
parent
b8c48d06fa
commit
b1a2ad6925
|
@ -249,11 +249,11 @@ class BackendTestCase(TransactionTestCase):
|
||||||
|
|
||||||
def test_cursor_executemany_with_iterator(self):
|
def test_cursor_executemany_with_iterator(self):
|
||||||
# Test executemany accepts iterators #10320
|
# Test executemany accepts iterators #10320
|
||||||
args = iter((i, i ** 2) for i in range(-3, 2))
|
args = ((i, i ** 2) for i in range(-3, 2))
|
||||||
self.create_squares_with_executemany(args)
|
self.create_squares_with_executemany(args)
|
||||||
self.assertEqual(Square.objects.count(), 5)
|
self.assertEqual(Square.objects.count(), 5)
|
||||||
|
|
||||||
args = iter((i, i ** 2) for i in range(3, 7))
|
args = ((i, i ** 2) for i in range(3, 7))
|
||||||
with override_settings(DEBUG=True):
|
with override_settings(DEBUG=True):
|
||||||
# same test for DebugCursorWrapper
|
# same test for DebugCursorWrapper
|
||||||
self.create_squares_with_executemany(args)
|
self.create_squares_with_executemany(args)
|
||||||
|
@ -278,11 +278,11 @@ class BackendTestCase(TransactionTestCase):
|
||||||
|
|
||||||
@skipUnlessDBFeature('supports_paramstyle_pyformat')
|
@skipUnlessDBFeature('supports_paramstyle_pyformat')
|
||||||
def test_cursor_executemany_with_pyformat_iterator(self):
|
def test_cursor_executemany_with_pyformat_iterator(self):
|
||||||
args = iter({'root': i, 'square': i ** 2} for i in range(-3, 2))
|
args = ({'root': i, 'square': i ** 2} for i in range(-3, 2))
|
||||||
self.create_squares(args, 'pyformat', multiple=True)
|
self.create_squares(args, 'pyformat', multiple=True)
|
||||||
self.assertEqual(Square.objects.count(), 5)
|
self.assertEqual(Square.objects.count(), 5)
|
||||||
|
|
||||||
args = iter({'root': i, 'square': i ** 2} for i in range(3, 7))
|
args = ({'root': i, 'square': i ** 2} for i in range(3, 7))
|
||||||
with override_settings(DEBUG=True):
|
with override_settings(DEBUG=True):
|
||||||
# same test for DebugCursorWrapper
|
# same test for DebugCursorWrapper
|
||||||
self.create_squares(args, 'pyformat', multiple=True)
|
self.create_squares(args, 'pyformat', multiple=True)
|
||||||
|
|
|
@ -25,7 +25,7 @@ class VariableResolveLoggingTests(SimpleTestCase):
|
||||||
raise TestObject.SilentDoesNotExist("Attribute does not exist.")
|
raise TestObject.SilentDoesNotExist("Attribute does not exist.")
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(attr for attr in dir(TestObject) if attr[:2] != "__")
|
return (attr for attr in dir(TestObject) if attr[:2] != "__")
|
||||||
|
|
||||||
def __getitem__(self, item):
|
def __getitem__(self, item):
|
||||||
return self.__dict__[item]
|
return self.__dict__[item]
|
||||||
|
|
Loading…
Reference in New Issue