mirror of
https://github.com/django/django.git
synced 2025-11-18 02:56:45 +00:00
21 lines
786 B
Python
21 lines
786 B
Python
from django.db import new_connection
|
|
from django.test import SimpleTestCase, skipUnlessDBFeature
|
|
|
|
|
|
@skipUnlessDBFeature("supports_async")
|
|
class AsyncDatabaseWrapperTests(SimpleTestCase):
|
|
databases = {"default", "other"}
|
|
|
|
async def test_async_cursor(self):
|
|
async with new_connection() as conn:
|
|
async with conn.acursor() as cursor:
|
|
await cursor.execute("SELECT 1")
|
|
result = (await cursor.fetchone())[0]
|
|
self.assertEqual(result, 1)
|
|
|
|
async def test_async_cursor_alias(self):
|
|
async with new_connection() as conn:
|
|
async with conn.acursor() as cursor:
|
|
await cursor.aexecute("SELECT 1")
|
|
result = (await cursor.afetchone())[0]
|
|
self.assertEqual(result, 1)
|