MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / test_concat_functions

Function test_concat_functions

tests/test_aggregation.py:174–184  ·  view source on GitHub ↗
(db)

Source from the content-addressed store, hash-verified

172@test.requireCapability(dialect=In("postgres", "mssql"))
173@pytest.mark.asyncio
174async def test_concat_functions(db):
175 author = await Author.create(name="Some One")
176 await Book.create(name="Physics Book", author=author, rating=4, subject="physics ")
177 await Book.create(name="Mathematics Book", author=author, rating=3, subject=" mathematics")
178 await Book.create(name="No-subject Book", author=author, rating=3)
179 ret = (
180 await Book.all()
181 .annotate(long_info=Max(Concat("name", "(", Coalesce(Trim("subject"), "others"), ")")))
182 .values("long_info")
183 )
184 assert ret == [{"long_info": "Physics Book(physics)"}]
185
186
187@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 8

MaxClass · 0.90
ConcatClass · 0.90
CoalesceClass · 0.90
TrimClass · 0.90
createMethod · 0.45
valuesMethod · 0.45
annotateMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…