Skip to content

Commit 347bae9

Browse files
gordthompsonrafiss
authored andcommitted
Fix test_with_hint to work with asyncpg
Test assumed psycopg2 parameter style ("pyformat") so it failed under asyncpg which uses a different paramstyle ("format").
1 parent 1540c41 commit 347bae9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/test_with_hint.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
from sqlalchemy import String
66
from sqlalchemy import Table
77
from sqlalchemy.testing import AssertsCompiledSQL
8+
from sqlalchemy.testing import config
89
from sqlalchemy.testing import fixtures
910
from sqlalchemy.testing import provide_metadata
1011

1112

1213
class WithHintTest(fixtures.TestBase, AssertsCompiledSQL):
13-
# __requires__ = ("sync_driver",)
1414

1515
@provide_metadata
1616
def test_with_hint(self):
@@ -26,7 +26,8 @@ def test_with_hint(self):
2626
select(t).with_hint(t, "ix_t_txt"),
2727
"SELECT t.id, t.txt FROM t@ix_t_txt",
2828
)
29+
param_placeholder = "%s" if config.db.dialect.is_async else "%(id_1)s"
2930
self.assert_compile(
3031
select(t).with_hint(t, "ix_t_txt").where(t.c.id < 3),
31-
"SELECT t.id, t.txt FROM t@ix_t_txt WHERE t.id < %(id_1)s",
32+
f"SELECT t.id, t.txt FROM t@ix_t_txt WHERE t.id < {param_placeholder}",
3233
)

0 commit comments

Comments
 (0)