@@ -27,46 +27,54 @@ async def test_engine() -> AsyncEngine:
2727 # Create test tables
2828 async with engine .begin () as conn :
2929 await conn .execute (
30- text ("""
30+ text (
31+ """
3132 CREATE TABLE customers (
3233 id INTEGER PRIMARY KEY AUTOINCREMENT,
3334 name VARCHAR(100) NOT NULL,
3435 email VARCHAR(255),
3536 state VARCHAR(50)
3637 )
37- """ )
38+ """
39+ )
3840 )
3941
4042 await conn .execute (
41- text ("""
43+ text (
44+ """
4245 CREATE TABLE orders (
4346 id INTEGER PRIMARY KEY AUTOINCREMENT,
4447 customer_id INTEGER NOT NULL,
4548 amount DECIMAL(10, 2) NOT NULL,
4649 order_date DATE NOT NULL,
4750 FOREIGN KEY (customer_id) REFERENCES customers(id)
4851 )
49- """ )
52+ """
53+ )
5054 )
5155
5256 # Insert test data
5357 await conn .execute (
54- text ("""
58+ text (
59+ """
5560 INSERT INTO customers (name, email, state) VALUES
5661 ('Alice', '[email protected] ', 'California'), 5762 ('Bob', '[email protected] ', 'New York'), 5863 ('Charlie', '[email protected] ', 'California') 59- """ )
64+ """
65+ )
6066 )
6167
6268 await conn .execute (
63- text ("""
69+ text (
70+ """
6471 INSERT INTO orders (customer_id, amount, order_date) VALUES
6572 (1, 100.50, '2024-01-15'),
6673 (1, 200.00, '2024-02-20'),
6774 (2, 150.75, '2024-01-20'),
6875 (3, 75.25, '2024-03-01')
69- """ )
76+ """
77+ )
7078 )
7179
7280 yield engine
@@ -356,13 +364,15 @@ async def test_join_query(self, test_session: AsyncSession) -> None:
356364 """Test JOIN query."""
357365 executor = SafeQueryExecutor (test_session )
358366
359- result = await executor .execute ("""
367+ result = await executor .execute (
368+ """
360369 SELECT c.name, SUM(o.amount) as total_orders
361370 FROM customers c
362371 JOIN orders o ON c.id = o.customer_id
363372 GROUP BY c.id
364373 ORDER BY total_orders DESC
365- """ )
374+ """
375+ )
366376
367377 assert result .success is True
368378 assert result .row_count == 3
@@ -376,7 +386,8 @@ async def test_cte_query(self, test_session: AsyncSession) -> None:
376386 """Test Common Table Expression (CTE) query."""
377387 executor = SafeQueryExecutor (test_session )
378388
379- result = await executor .execute ("""
389+ result = await executor .execute (
390+ """
380391 WITH customer_totals AS (
381392 SELECT customer_id, SUM(amount) as total
382393 FROM orders
@@ -385,7 +396,8 @@ async def test_cte_query(self, test_session: AsyncSession) -> None:
385396 SELECT c.name, ct.total
386397 FROM customers c
387398 JOIN customer_totals ct ON c.id = ct.customer_id
388- """ )
399+ """
400+ )
389401
390402 assert result .success is True
391403 assert result .row_count == 3
@@ -468,4 +480,3 @@ async def test_schema_to_query_flow(self, test_engine: AsyncEngine) -> None:
468480 for row in result .rows :
469481 assert "name" in row
470482 assert "order_count" in row
471-
0 commit comments