diff options
author | django-bot <ops@djangoproject.com> | 2022-02-03 20:24:19 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-02-07 20:37:05 +0100 |
commit | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 (patch) | |
tree | f0506b668a013d0063e5fba3dbf4863b466713ba /tests/db_functions/text/test_right.py | |
parent | f68fa8b45dfac545cfc4111d4e52804c86db68d3 (diff) | |
download | django-9c19aff7c7561e3a82978a272ecdaad40dda5c00.tar.gz |
Refs #33476 -- Reformatted code with Black.
Diffstat (limited to 'tests/db_functions/text/test_right.py')
-rw-r--r-- | tests/db_functions/text/test_right.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/db_functions/text/test_right.py b/tests/db_functions/text/test_right.py index ab29cb9456..8c271fcf7d 100644 --- a/tests/db_functions/text/test_right.py +++ b/tests/db_functions/text/test_right.py @@ -8,20 +8,28 @@ from ..models import Author class RightTests(TestCase): @classmethod def setUpTestData(cls): - Author.objects.create(name='John Smith', alias='smithj') - Author.objects.create(name='Rhonda') + Author.objects.create(name="John Smith", alias="smithj") + Author.objects.create(name="Rhonda") def test_basic(self): - authors = Author.objects.annotate(name_part=Right('name', 5)) - self.assertQuerysetEqual(authors.order_by('name'), ['Smith', 'honda'], lambda a: a.name_part) + authors = Author.objects.annotate(name_part=Right("name", 5)) + self.assertQuerysetEqual( + authors.order_by("name"), ["Smith", "honda"], lambda a: a.name_part + ) # If alias is null, set it to the first 2 lower characters of the name. - Author.objects.filter(alias__isnull=True).update(alias=Lower(Right('name', 2))) - self.assertQuerysetEqual(authors.order_by('name'), ['smithj', 'da'], lambda a: a.alias) + Author.objects.filter(alias__isnull=True).update(alias=Lower(Right("name", 2))) + self.assertQuerysetEqual( + authors.order_by("name"), ["smithj", "da"], lambda a: a.alias + ) def test_invalid_length(self): with self.assertRaisesMessage(ValueError, "'length' must be greater than 0"): - Author.objects.annotate(raises=Right('name', 0)) + Author.objects.annotate(raises=Right("name", 0)) def test_expressions(self): - authors = Author.objects.annotate(name_part=Right('name', Value(3, output_field=IntegerField()))) - self.assertQuerysetEqual(authors.order_by('name'), ['ith', 'nda'], lambda a: a.name_part) + authors = Author.objects.annotate( + name_part=Right("name", Value(3, output_field=IntegerField())) + ) + self.assertQuerysetEqual( + authors.order_by("name"), ["ith", "nda"], lambda a: a.name_part + ) |