summaryrefslogtreecommitdiff
path: root/tests/string_lookup
diff options
context:
space:
mode:
Diffstat (limited to 'tests/string_lookup')
-rw-r--r--tests/string_lookup/models.py4
-rw-r--r--tests/string_lookup/tests.py26
2 files changed, 19 insertions, 11 deletions
diff --git a/tests/string_lookup/models.py b/tests/string_lookup/models.py
index 48001b42d7..71510f5b2f 100644
--- a/tests/string_lookup/models.py
+++ b/tests/string_lookup/models.py
@@ -8,7 +8,7 @@ class Foo(models.Model):
class Bar(models.Model):
name = models.CharField(max_length=50)
- normal = models.ForeignKey(Foo, models.CASCADE, related_name='normal_foo')
+ normal = models.ForeignKey(Foo, models.CASCADE, related_name="normal_foo")
fwd = models.ForeignKey("Whiz", models.CASCADE)
back = models.ForeignKey("Foo", models.CASCADE)
@@ -18,7 +18,7 @@ class Whiz(models.Model):
class Child(models.Model):
- parent = models.OneToOneField('Base', models.CASCADE)
+ parent = models.OneToOneField("Base", models.CASCADE)
name = models.CharField(max_length=50)
diff --git a/tests/string_lookup/tests.py b/tests/string_lookup/tests.py
index a8e39dbb6c..cc7d36061a 100644
--- a/tests/string_lookup/tests.py
+++ b/tests/string_lookup/tests.py
@@ -4,7 +4,6 @@ from .models import Article, Bar, Base, Child, Foo, Whiz
class StringLookupTests(TestCase):
-
def test_string_form_referencing(self):
"""
Regression test for #1661 and #1662
@@ -47,9 +46,9 @@ class StringLookupTests(TestCase):
A properly configured UTF-8 database can handle this.
"""
- fx = Foo(name='Bjorn', friend='François')
+ fx = Foo(name="Bjorn", friend="François")
fx.save()
- self.assertEqual(Foo.objects.get(friend__contains='\xe7'), fx)
+ self.assertEqual(Foo.objects.get(friend__contains="\xe7"), fx)
def test_queries_on_textfields(self):
"""
@@ -58,11 +57,16 @@ class StringLookupTests(TestCase):
make sure we can perform queries on TextFields.
"""
- a = Article(name='Test', text='The quick brown fox jumps over the lazy dog.')
+ a = Article(name="Test", text="The quick brown fox jumps over the lazy dog.")
a.save()
- self.assertEqual(Article.objects.get(text__exact='The quick brown fox jumps over the lazy dog.'), a)
+ self.assertEqual(
+ Article.objects.get(
+ text__exact="The quick brown fox jumps over the lazy dog."
+ ),
+ a,
+ )
- self.assertEqual(Article.objects.get(text__contains='quick brown fox'), a)
+ self.assertEqual(Article.objects.get(text__contains="quick brown fox"), a)
def test_ipaddress_on_postgresql(self):
"""
@@ -70,8 +74,12 @@ class StringLookupTests(TestCase):
"like" queries on IP address fields require casting with HOST() (on PostgreSQL).
"""
- a = Article(name='IP test', text='The body', submitted_from='192.0.2.100')
+ a = Article(name="IP test", text="The body", submitted_from="192.0.2.100")
a.save()
- self.assertSequenceEqual(Article.objects.filter(submitted_from__contains='192.0.2'), [a])
+ self.assertSequenceEqual(
+ Article.objects.filter(submitted_from__contains="192.0.2"), [a]
+ )
# The searches do not match the subnet mask (/32 in this case)
- self.assertEqual(Article.objects.filter(submitted_from__contains='32').count(), 0)
+ self.assertEqual(
+ Article.objects.filter(submitted_from__contains="32").count(), 0
+ )