diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/backends/postgresql/test_creation.py | 2 | ||||
| -rw-r--r-- | tests/backends/postgresql/test_server_side_cursors.py | 2 | ||||
| -rw-r--r-- | tests/introspection/tests.py | 4 | ||||
| -rw-r--r-- | tests/schema/tests.py | 10 | ||||
| -rw-r--r-- | tests/serializers/test_data.py | 2 | ||||
| -rw-r--r-- | tests/validation/test_unique.py | 2 | ||||
| -rw-r--r-- | tests/view_tests/tests/test_debug.py | 4 |
7 files changed, 13 insertions, 13 deletions
diff --git a/tests/backends/postgresql/test_creation.py b/tests/backends/postgresql/test_creation.py index 9554e97a54..9f51d5e6b2 100644 --- a/tests/backends/postgresql/test_creation.py +++ b/tests/backends/postgresql/test_creation.py @@ -33,7 +33,7 @@ class DatabaseCreationTests(SimpleTestCase): try: yield finally: - for name, value in kwargs.items(): + for name in kwargs: if name in saved_values: settings[name] = saved_values[name] else: diff --git a/tests/backends/postgresql/test_server_side_cursors.py b/tests/backends/postgresql/test_server_side_cursors.py index ff06318e6c..0cc3423a9b 100644 --- a/tests/backends/postgresql/test_server_side_cursors.py +++ b/tests/backends/postgresql/test_server_side_cursors.py @@ -27,7 +27,7 @@ class ServerSideCursorsPostgres(TestCase): @contextmanager def override_db_setting(self, **kwargs): - for setting, value in kwargs.items(): + for setting in kwargs: original_value = connection.settings_dict.get(setting) if setting in connection.settings_dict: self.addCleanup(operator.setitem, connection.settings_dict, setting, original_value) diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py index 63817a5e3d..a66ecaba03 100644 --- a/tests/introspection/tests.py +++ b/tests/introspection/tests.py @@ -176,7 +176,7 @@ class IntrospectionTests(TransactionTestCase): constraints = connection.introspection.get_constraints(cursor, Article._meta.db_table) index = {} index2 = {} - for key, val in constraints.items(): + for val in constraints.values(): if val['columns'] == ['headline', 'pub_date']: index = val if val['columns'] == ['headline', 'response_to_id', 'pub_date', 'reporter_id']: @@ -198,7 +198,7 @@ class IntrospectionTests(TransactionTestCase): ['response_to_id'], ['headline', 'response_to_id', 'pub_date', 'reporter_id'], ] - for key, val in constraints.items(): + for val in constraints.values(): if val['index'] and not (val['primary_key'] or val['unique']): self.assertIn(val['columns'], expected_columns) self.assertEqual(val['orders'], ['ASC'] * len(val['columns'])) diff --git a/tests/schema/tests.py b/tests/schema/tests.py index 21ab60466f..7b6c99242d 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -180,7 +180,7 @@ class SchemaTests(TransactionTestCase): """ constraints = self.get_constraints(model._meta.db_table) constraint_fk = None - for name, details in constraints.items(): + for details in constraints.values(): if details['columns'] == [column] and details['foreign_key']: constraint_fk = details['foreign_key'] break @@ -836,7 +836,7 @@ class SchemaTests(TransactionTestCase): editor.create_model(LocalBook) # Ensure no FK constraint exists constraints = self.get_constraints(LocalBook._meta.db_table) - for name, details in constraints.items(): + for details in constraints.values(): if details['foreign_key']: self.fail('Found an unexpected FK constraint to %s' % details['columns']) old_field = LocalBook._meta.get_field("author") @@ -1430,7 +1430,7 @@ class SchemaTests(TransactionTestCase): editor.create_model(Author) # Ensure the constraint exists constraints = self.get_constraints(Author._meta.db_table) - for name, details in constraints.items(): + for details in constraints.values(): if details['columns'] == ["height"] and details['check']: break else: @@ -1442,7 +1442,7 @@ class SchemaTests(TransactionTestCase): with connection.schema_editor() as editor: editor.alter_field(Author, old_field, new_field, strict=True) constraints = self.get_constraints(Author._meta.db_table) - for name, details in constraints.items(): + for details in constraints.values(): if details['columns'] == ["height"] and details['check']: self.fail("Check constraint for height found") # Alter the column to re-add it @@ -1450,7 +1450,7 @@ class SchemaTests(TransactionTestCase): with connection.schema_editor() as editor: editor.alter_field(Author, new_field, new_field2, strict=True) constraints = self.get_constraints(Author._meta.db_table) - for name, details in constraints.items(): + for details in constraints.values(): if details['columns'] == ["height"] and details['check']: break else: diff --git a/tests/serializers/test_data.py b/tests/serializers/test_data.py index 62ce2bbfec..467292bff1 100644 --- a/tests/serializers/test_data.py +++ b/tests/serializers/test_data.py @@ -106,7 +106,7 @@ def inherited_create(pk, klass, data): # automatically is easier than manually creating both. models.Model.save(instance) created = [instance] - for klass, field in instance._meta.parents.items(): + for klass in instance._meta.parents: created.append(klass.objects.get(id=pk)) return created diff --git a/tests/validation/test_unique.py b/tests/validation/test_unique.py index 11d06eeb4d..002e568ae9 100644 --- a/tests/validation/test_unique.py +++ b/tests/validation/test_unique.py @@ -47,7 +47,7 @@ class GetUniqueCheckTests(unittest.TestCase): (('foo', 'bar'), ('bar', 'baz'))), } - for test_name, (unique_together, normalized) in data.items(): + for unique_together, normalized in data.values(): class M(models.Model): foo = models.IntegerField() bar = models.IntegerField() diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index f0b2d017d4..aa2cc1c721 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -769,7 +769,7 @@ class ExceptionReportTestMixin: self.assertContains(response, 'sauce', status_code=500) self.assertNotContains(response, 'worcestershire', status_code=500) if check_for_POST_params: - for k, v in self.breakfast_data.items(): + for k in self.breakfast_data: # All POST parameters' names are shown. self.assertContains(response, k, status_code=500) # Non-sensitive POST parameters' values are shown. @@ -858,7 +858,7 @@ class ExceptionReportTestMixin: self.assertNotIn('worcestershire', body_html) if check_for_POST_params: - for k, v in self.breakfast_data.items(): + for k in self.breakfast_data: # All POST parameters' names are shown. self.assertIn(k, body_plain) # Non-sensitive POST parameters' values are shown. |
