Fix Limit 0 QuerySet Empty List (#767)
* fix: debug condition check not none limit count * test: write a test for check zero limit empty list * fix: debug assert check empty list with is keyword
This commit is contained in:
@ -47,6 +47,18 @@ def create_test_database():
|
||||
metadata.drop_all(engine)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_limit_zero():
|
||||
async with database:
|
||||
async with database.transaction(force_rollback=True):
|
||||
for i in range(5):
|
||||
await Car(name=f"{i}").save()
|
||||
|
||||
cars = await Car.objects.limit(0).all()
|
||||
assert cars == []
|
||||
assert len(cars) == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_pagination_errors():
|
||||
async with database:
|
||||
|
||||
Reference in New Issue
Block a user