diff options
| author | django-bot <ops@djangoproject.com> | 2022-02-08 12:09:55 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-02-08 12:15:38 +0100 |
| commit | 6a682b38e75d4c975b4c4493565a59f1bc14397c (patch) | |
| tree | 0bd9cda550bea26238656d9f120d769e8b41bb9e /tests/string_lookup/tests.py | |
| parent | e73ce08888e6f34d3f050377cfd2fbb733be94a9 (diff) | |
[4.0.x] Refs #33476 -- Reformatted code with Black.
Backport of 9c19aff7c7561e3a82978a272ecdaad40dda5c00 from main.
Diffstat (limited to 'tests/string_lookup/tests.py')
| -rw-r--r-- | tests/string_lookup/tests.py | 26 |
1 files changed, 17 insertions, 9 deletions
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 + ) |
