diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/db_functions/text/test_chr.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/db_functions/text/test_chr.py b/tests/db_functions/text/test_chr.py index 7a55994096..fe1aea3f2c 100644 --- a/tests/db_functions/text/test_chr.py +++ b/tests/db_functions/text/test_chr.py @@ -1,4 +1,4 @@ -from django.db.models import IntegerField +from django.db.models import F, IntegerField from django.db.models.functions import Chr, Left, Ord from django.test import TestCase from django.test.utils import register_lookup @@ -37,3 +37,13 @@ class ChrTests(TestCase): authors.exclude(name_code_point__chr=Chr(ord("J"))), [self.elena, self.rhonda], ) + + def test_annotate(self): + authors = Author.objects.annotate( + first_initial=Left("name", 1), + initial_chr=Chr(ord("J")), + ) + self.assertSequenceEqual( + authors.filter(first_initial=F("initial_chr")), + [self.john], + ) |
