Skip to content

Commit 047cff0

Browse files
committed
Python: test aiomysql
1 parent 330c2c4 commit 047cff0

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

python/ql/test/library-tests/frameworks/aiomysql/ConceptsTest.expected

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import experimental.meta.ConceptsTest
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import aiomysql
2+
3+
# Only a cursor can execute sql.
4+
async def test_cursor():
5+
# Create connection directly
6+
conn = await aiomysql.connect()
7+
cur = await conn.cursor()
8+
await cur.execute("sql") # $ MISSING: getSql="sql" constructedSql="sql"
9+
10+
# Create connection via pool
11+
async with aiomysql.create_pool() as pool:
12+
# Create Cursor via Connection
13+
async with pool.acquire() as conn:
14+
async with conn.cursor() as cur:
15+
await cur.execute("sql") # $ MISSING: getSql="sql" constructedSql="sql"
16+
17+
# Create Cursor directly
18+
async with pool.cursor() as cur:
19+
await cur.execute("sql") # $ MISSING: getSql="sql" constructedSql="sql"
20+
21+
# variants using as few `async with` as possible
22+
pool = await aiomysql.create_pool()
23+
conn = await pool.acquire()
24+
cur = await conn.cursor()
25+
await cur.execute("sql") # $ MISSING: getSql="sql" constructedSql="sql"
26+
27+
# Test SQLAlchemy integration
28+
from aiomysql.sa import create_engine
29+
30+
async def test_engine():
31+
engine = await create_engine()
32+
conn = await engine.acquire()
33+
await conn.execute("sql") # $ MISSING: getSql="sql" constructedSql="sql"

0 commit comments

Comments
 (0)