MCPcopy
hub / github.com/django/django / test_expressions

Method test_expressions

tests/db_functions/text/test_reverse.py:53–65  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

51 )
52
53 def test_expressions(self):
54 author = Author.objects.annotate(backward=Reverse(Trim("name"))).get(
55 pk=self.john.pk
56 )
57 self.assertEqual(author.backward, self.john.name[::-1])
58 with register_lookup(CharField, Reverse), register_lookup(CharField, Length):
59 authors = Author.objects.all()
60 self.assertCountEqual(
61 authors.filter(name__reverse__length__gt=7), [self.john, self.elena]
62 )
63 self.assertCountEqual(
64 authors.exclude(name__reverse__length__gt=7), [self.python]
65 )

Callers

nothing calls this directly

Calls 8

ReverseClass · 0.90
TrimClass · 0.90
register_lookupFunction · 0.90
annotateMethod · 0.80
excludeMethod · 0.80
getMethod · 0.45
allMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected