MCPcopy
hub / github.com/django/django / test_mixed_char_text

Method test_mixed_char_text

tests/db_functions/text/test_concat.py:60–76  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

58 )
59
60 def test_mixed_char_text(self):
61 Article.objects.create(
62 title="The Title", text=lorem_ipsum, written=timezone.now()
63 )
64 article = Article.objects.annotate(
65 title_text=Concat("title", V(" - "), "text", output_field=TextField()),
66 ).get(title="The Title")
67 self.assertEqual(article.title + " - " + article.text, article.title_text)
68 # Wrap the concat in something else to ensure that text is returned
69 # rather than bytes.
70 article = Article.objects.annotate(
71 title_text=Upper(
72 Concat("title", V(" - "), "text", output_field=TextField())
73 ),
74 ).get(title="The Title")
75 expected = article.title + " - " + article.text
76 self.assertEqual(expected.upper(), article.title_text)
77
78 @skipUnless(
79 connection.vendor in ("sqlite", "postgresql"),

Callers

nothing calls this directly

Calls 7

ConcatClass · 0.90
TextFieldClass · 0.90
UpperClass · 0.90
annotateMethod · 0.80
createMethod · 0.45
nowMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected