Fix collerek/ormar#588 Bug in queryset count() method
This commit is contained in:
@ -175,3 +175,15 @@ async def test_queryset_method():
|
||||
assert await author.books.max(["year", "title"]) == dict(
|
||||
year=1930, title="Book 3"
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_count_method():
|
||||
async with database:
|
||||
await sample_data()
|
||||
|
||||
count = await Author.objects.select_related("books").count()
|
||||
assert count == 1
|
||||
|
||||
# The legacy functionality
|
||||
count = await Author.objects.select_related("books").count(distinct=False)
|
||||
assert count == 3
|
||||
|
||||
Reference in New Issue
Block a user