MCPcopy
hub / github.com/django/django / test_cast_from_field

Method test_cast_from_field

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

Source from the content-addressed store, hash-verified

22 self.assertEqual(numbers.get().cast_integer, 0)
23
24 def test_cast_from_field(self):
25 numbers = Author.objects.annotate(
26 cast_string=Cast("age", models.CharField(max_length=255)),
27 )
28 self.assertEqual(numbers.get().cast_string, "1")
29
30 def test_cast_to_char_field_without_max_length(self):
31 numbers = Author.objects.annotate(cast_string=Cast("age", models.CharField()))

Callers

nothing calls this directly

Calls 3

CastClass · 0.90
annotateMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected