MCPcopy
hub / github.com/django/django / test_cast_from_value

Method test_cast_from_value

tests/db_functions/comparison/test_cast.py:18–22  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

16 Author.objects.create(name="Bob", age=1, alias="1")
17
18 def test_cast_from_value(self):
19 numbers = Author.objects.annotate(
20 cast_integer=Cast(models.Value("0"), models.IntegerField())
21 )
22 self.assertEqual(numbers.get().cast_integer, 0)
23
24 def test_cast_from_field(self):
25 numbers = Author.objects.annotate(

Callers

nothing calls this directly

Calls 3

CastClass · 0.90
annotateMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected