MCPcopy
hub / github.com/django/django / test_start

Method test_start

tests/db_functions/text/test_substr.py:28–35  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

26 )
27
28 def test_start(self):
29 Author.objects.create(name="John Smith", alias="smithj")
30 a = Author.objects.annotate(
31 name_part_1=Substr("name", 1),
32 name_part_2=Substr("name", 2),
33 ).get(alias="smithj")
34
35 self.assertEqual(a.name_part_1[1:], a.name_part_2)
36
37 def test_pos_gt_zero(self):
38 with self.assertRaisesMessage(ValueError, "'pos' must be greater than 0"):

Callers

nothing calls this directly

Calls 4

SubstrClass · 0.90
annotateMethod · 0.80
createMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected