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

Method test_expressions

tests/db_functions/json/test_json_object.py:30–49  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected