summaryrefslogtreecommitdiff
path: root/tests/backends/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/backends/tests.py')
-rw-r--r--tests/backends/tests.py40
1 files changed, 32 insertions, 8 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 25f7432a46..b7b8c9cade 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -157,7 +157,11 @@ class PostgreSQLTests(TestCase):
self.assert_parses("EnterpriseDB 9.3", 90300)
self.assert_parses("PostgreSQL 9.3.6", 90306)
self.assert_parses("PostgreSQL 9.4beta1", 90400)
- self.assert_parses("PostgreSQL 9.3.1 on i386-apple-darwin9.2.2, compiled by GCC i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5478)", 90301)
+ self.assert_parses(
+ "PostgreSQL 9.3.1 on i386-apple-darwin9.2.2, compiled by GCC "
+ "i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5478)",
+ 90301
+ )
def test_nodb_connection(self):
"""
@@ -419,13 +423,19 @@ class LongNameTest(TransactionTestCase):
models.VeryLongModelNameZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ.objects.create()
def test_sequence_name_length_limits_m2m(self):
- """Test an m2m save of a model with a long name and a long m2m field name doesn't error as on Django >=1.2 this now uses object saves. Ref #8901"""
+ """
+ An m2m save of a model with a long name and a long m2m field name
+ doesn't error (#8901).
+ """
obj = models.VeryLongModelNameZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ.objects.create()
rel_obj = models.Person.objects.create(first_name='Django', last_name='Reinhardt')
obj.m2m_also_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.add(rel_obj)
def test_sequence_name_length_limits_flush(self):
- """Test that sequence resetting as part of a flush with model with long name and long pk name doesn't error. Ref #8901"""
+ """
+ Sequence resetting as part of a flush with model with long name and
+ long pk name doesn't error (#8901).
+ """
# A full flush is expensive to the full test, so we dig into the
# internals to generate the likely offending SQL and run it manually
@@ -834,11 +844,16 @@ class FkConstraintsTests(TransactionTestCase):
def test_disable_constraint_checks_manually(self):
"""
- When constraint checks are disabled, should be able to write bad data without IntegrityErrors.
+ When constraint checks are disabled, should be able to write bad data
+ without IntegrityErrors.
"""
with transaction.atomic():
# Create an Article.
- models.Article.objects.create(headline="Test article", pub_date=datetime.datetime(2010, 9, 4), reporter=self.r)
+ models.Article.objects.create(
+ headline="Test article",
+ pub_date=datetime.datetime(2010, 9, 4),
+ reporter=self.r,
+ )
# Retrieve it from the DB
a = models.Article.objects.get(headline="Test article")
a.reporter_id = 30
@@ -852,11 +867,16 @@ class FkConstraintsTests(TransactionTestCase):
def test_disable_constraint_checks_context_manager(self):
"""
- When constraint checks are disabled (using context manager), should be able to write bad data without IntegrityErrors.
+ When constraint checks are disabled (using context manager), should be
+ able to write bad data without IntegrityErrors.
"""
with transaction.atomic():
# Create an Article.
- models.Article.objects.create(headline="Test article", pub_date=datetime.datetime(2010, 9, 4), reporter=self.r)
+ models.Article.objects.create(
+ headline="Test article",
+ pub_date=datetime.datetime(2010, 9, 4),
+ reporter=self.r,
+ )
# Retrieve it from the DB
a = models.Article.objects.get(headline="Test article")
a.reporter_id = 30
@@ -873,7 +893,11 @@ class FkConstraintsTests(TransactionTestCase):
"""
with transaction.atomic():
# Create an Article.
- models.Article.objects.create(headline="Test article", pub_date=datetime.datetime(2010, 9, 4), reporter=self.r)
+ models.Article.objects.create(
+ headline="Test article",
+ pub_date=datetime.datetime(2010, 9, 4),
+ reporter=self.r,
+ )
# Retrieve it from the DB
a = models.Article.objects.get(headline="Test article")
a.reporter_id = 30