File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 12
12
import numpy as np
13
13
import pandas as pd
14
14
import pytest
15
+ import sqlalchemy
15
16
from sqlalchemy import (
16
17
Column ,
17
18
ForeignKey ,
@@ -434,15 +435,26 @@ def test_percent_signs(engine_testaccount, run_v20_sqlalchemy):
434
435
"""
435
436
)
436
437
437
- df = pd .read_sql (
438
- f"select * from { table_name } where c2 not like '%b%'" , conn
439
- )
438
+ not_like_sql = f"select * from { table_name } where c2 not like '%b%'"
439
+ like_sql = f"select * from { table_name } where c2 like '%b%'"
440
+ calculate_sql = "SELECT 1600 % 400 AS a, 1599 % 400 as b"
441
+ if run_v20_sqlalchemy :
442
+ not_like_sql = sqlalchemy .text (not_like_sql )
443
+ like_sql = sqlalchemy .text (like_sql )
444
+ calculate_sql = sqlalchemy .text (calculate_sql )
445
+
446
+ df = pd .read_sql (not_like_sql , conn )
440
447
assert list (df .itertuples (index = False , name = None )) == [
441
448
(2 , "def" ),
442
449
(3 , "ghi" ),
443
450
]
444
451
445
- df = pd .read_sql (f"select * from { table_name } where c2 like '%b%'" , conn )
452
+ df = pd .read_sql (like_sql , conn )
446
453
assert list (df .itertuples (index = False , name = None )) == [
447
454
(1 , "abc" ),
448
455
]
456
+
457
+ df = pd .read_sql (calculate_sql , conn )
458
+ assert list (df .itertuples (index = False , name = None )) == [
459
+ (0 , 399 ),
460
+ ]
You can’t perform that action at this time.
0 commit comments