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

Method test_expressions

tests/db_functions/json/test_json_array.py:29–48  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

27 self.assertEqual(obj.json_array, ["name", "Ivan Ivanov"])
28
29 def test_expressions(self):
30 obj = Author.objects.annotate(
31 json_array=JSONArray(
32 Lower("name"),
33 F("alias"),
34 F("goes_by"),
35 Value(30000.15),
36 F("age") * 2,
37 )
38 ).first()
39 self.assertEqual(
40 obj.json_array,
41 [
42 "ivan ivanov",
43 "iivanov",
44 None,
45 30000.15,
46 60,
47 ],
48 )
49
50 def test_nested_json_array(self):
51 obj = Author.objects.annotate(

Callers

nothing calls this directly

Calls 6

JSONArrayClass · 0.90
LowerClass · 0.90
FClass · 0.90
ValueClass · 0.90
firstMethod · 0.80
annotateMethod · 0.80

Tested by

no test coverage detected