Skip to content

Commit 9e07c57

Browse files
authored
Merge pull request #17 from rkisdp/feature/none_query
add none query feature and test for the same
2 parents 6ce2718 + b40b74d commit 9e07c57

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

django_async_orm/query.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ async def async_latest(self, *fields):
4242
async def async_first(self):
4343
return await sync_to_async(self.first, thread_sensitive=True)()
4444

45+
async def async_none(self):
46+
return await sync_to_async(self.none, thread_sensitive=True)()
47+
4548
async def async_last(self):
4649
return await sync_to_async(self.last, thread_sensitive=True)()
4750

tests/test_django_async_orm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ async def test_async_count(self):
135135
result = await TestModel.objects.async_all()
136136
self.assertEqual(result.count(), 1)
137137

138+
@tag('ci')
139+
async def test_async_none(self):
140+
result = await TestModel.objects.async_none()
141+
self.assertEqual(list(result), [])
142+
138143
@tag('ci')
139144
async def test_async_aiter(self):
140145
all_qs = await TestModel.objects.async_all()

0 commit comments

Comments
 (0)