From c3d7a71f836f7cfe8fa90dd9ae95b37b660d5aae Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Mon, 10 Apr 2023 16:30:08 -0400 Subject: Fixed #34480 -- Fixed crash of annotations with Chr(). --- tests/db_functions/text/test_chr.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests/db_functions') 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], + ) -- cgit v1.3