MCPcopy
hub / github.com/django/django / test_basic

Method test_basic

tests/db_functions/text/test_upper.py:10–30  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8
9class UpperTests(TestCase):
10 def test_basic(self):
11 Author.objects.create(name="John Smith", alias="smithj")
12 Author.objects.create(name="Rhonda")
13 authors = Author.objects.annotate(upper_name=Upper("name"))
14 self.assertQuerySetEqual(
15 authors.order_by("name"),
16 [
17 "JOHN SMITH",
18 "RHONDA",
19 ],
20 lambda a: a.upper_name,
21 )
22 Author.objects.update(name=Upper("name"))
23 self.assertQuerySetEqual(
24 authors.order_by("name"),
25 [
26 ("JOHN SMITH", "JOHN SMITH"),
27 ("RHONDA", "RHONDA"),
28 ],
29 lambda a: (a.upper_name, a.name),
30 )
31
32 def test_transform(self):
33 with register_lookup(CharField, Upper):

Callers

nothing calls this directly

Calls 6

UpperClass · 0.90
annotateMethod · 0.80
assertQuerySetEqualMethod · 0.80
order_byMethod · 0.80
createMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected