(self)
| 14 | cls.rhonda = Author.objects.create(name="Rhonda") |
| 15 | |
| 16 | def test_basic(self): |
| 17 | authors = Author.objects.annotate(first_initial=Left("name", 1)) |
| 18 | self.assertCountEqual(authors.filter(first_initial=Chr(ord("J"))), [self.john]) |
| 19 | self.assertCountEqual( |
| 20 | authors.exclude(first_initial=Chr(ord("J"))), [self.elena, self.rhonda] |
| 21 | ) |
| 22 | |
| 23 | def test_non_ascii(self): |
| 24 | authors = Author.objects.annotate(first_initial=Left("name", 1)) |