Implement page function (#339)

* implement page function

Signed-off-by: wiseaidev <business@wiseai.dev>

* add unit tests

Signed-off-by: wiseaidev <business@wiseai.dev>

* fix linter issues

Signed-off-by: wiseaidev <business@wiseai.dev>
This commit is contained in:
Mahmoud Harmouch 2022-08-10 14:04:27 +03:00 committed by GitHub
parent ac6a75be19
commit e5e887229a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -150,6 +150,23 @@ async def test_full_text_search_queries(members, m):
assert actual == [member1, member3]
@py_test_mark_asyncio
async def test_pagination_queries(members, m):
member1, member2, member3 = members
actual = await m.Member.find(m.Member.last_name == "Brookins").page()
assert actual == [member1, member2]
actual = await m.Member.find().page(1, 1)
assert actual == [member2]
actual = await m.Member.find().page(0, 1)
assert actual == [member1]
@py_test_mark_asyncio
async def test_recursive_query_resolution(members, m):
member1, member2, member3 = members