diff options
| author | Tim Graham <timograham@gmail.com> | 2018-01-02 10:11:48 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-01-02 10:11:48 -0500 |
| commit | 5f456408a0f52dc16f627d4a89ced5f52c36ad2f (patch) | |
| tree | 629affc6d0a20f236db648a6387327a5b99de160 /tests | |
| parent | f5a989e60394ac11f5dce886468a34533caefcbf (diff) | |
Refs #28930 -- Simplified schemas test with any().
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/schema/tests.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py index fd66bf20ba..cc2d5384f8 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -1469,10 +1469,7 @@ class SchemaTests(TransactionTestCase): editor.create_model(Author) # Ensure the constraint exists constraints = self.get_constraints(Author._meta.db_table) - for details in constraints.values(): - if details['columns'] == ["height"] and details['check']: - break - else: + if not any(details['columns'] == ['height'] and details['check'] for details in constraints.values()): self.fail("No check constraint for height found") # Alter the column to remove it old_field = Author._meta.get_field("height") @@ -1489,10 +1486,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 details in constraints.values(): - if details['columns'] == ["height"] and details['check']: - break - else: + if not any(details['columns'] == ['height'] and details['check'] for details in constraints.values()): self.fail("No check constraint for height found") def test_unique(self): |
