MCPcopy
hub / github.com/tortoise/tortoise-orm / test_distinct

Function test_distinct

tests/test_queryset.py:175–187  ·  view source on GitHub ↗
(db, intfields_data)

Source from the content-addressed store, hash-verified

173
174@pytest.mark.asyncio
175async def test_distinct(db, intfields_data):
176 # Test distinct
177 await IntFields.filter(intnum__gte=70).update(intnum_null=80)
178 await IntFields.filter(intnum_null__isnull=True).update(intnum_null=-1)
179
180 assert await IntFields.all().order_by("intnum_null").distinct().values_list(
181 "intnum_null", flat=True
182 ) == [-1, 80]
183
184 assert await IntFields.all().order_by("intnum_null").distinct().values("intnum_null") == [
185 {"intnum_null": -1},
186 {"intnum_null": 80},
187 ]
188
189
190@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 7

updateMethod · 0.80
distinctMethod · 0.80
filterMethod · 0.45
values_listMethod · 0.45
order_byMethod · 0.45
allMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…