summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2021-09-14 23:38:00 +0200
committerMike Bayer <mike_mp@zzzcomputing.com>2021-11-26 10:14:44 -0500
commit5eb407f84bdabdbcd68975dbf76dc4c0809d7373 (patch)
tree0d37ab4b9c28d8a0fa6cefdcc1933d52ffd9a599 /test/sql
parent8ddb3ef165d0c2d6d7167bb861bb349e68b5e8df (diff)
downloadsqlalchemy-5eb407f84bdabdbcd68975dbf76dc4c0809d7373.tar.gz
Added support for ``psycopg`` dialect.
Both sync and async versions are supported. Fixes: #6842 Change-Id: I57751c5028acebfc6f9c43572562405453a2f2a4
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_types.py47
1 files changed, 23 insertions, 24 deletions
diff --git a/test/sql/test_types.py b/test/sql/test_types.py
index f63e1e01b..35467de94 100644
--- a/test/sql/test_types.py
+++ b/test/sql/test_types.py
@@ -2459,15 +2459,16 @@ class EnumTest(AssertsCompiledSQL, fixtures.TablesTest):
@testing.combinations(
(True, "omit_alias"), (False, "with_alias"), id_="ai", argnames="omit"
)
- @testing.provide_metadata
@testing.skip_if("mysql < 8")
- def test_duplicate_values_accepted(self, native, omit):
+ def test_duplicate_values_accepted(
+ self, metadata, connection, native, omit
+ ):
foo_enum = pep435_enum("foo_enum")
foo_enum("one", 1, "two")
foo_enum("three", 3, "four")
tbl = sa.Table(
"foo_table",
- self.metadata,
+ metadata,
sa.Column("id", sa.Integer),
sa.Column(
"data",
@@ -2481,7 +2482,7 @@ class EnumTest(AssertsCompiledSQL, fixtures.TablesTest):
)
t = sa.table("foo_table", sa.column("id"), sa.column("data"))
- self.metadata.create_all(testing.db)
+ metadata.create_all(connection)
if omit:
with expect_raises(
(
@@ -2491,29 +2492,27 @@ class EnumTest(AssertsCompiledSQL, fixtures.TablesTest):
exc.DBAPIError,
)
):
- with testing.db.begin() as conn:
- conn.execute(
- t.insert(),
- [
- {"id": 1, "data": "four"},
- {"id": 2, "data": "three"},
- ],
- )
- else:
- with testing.db.begin() as conn:
- conn.execute(
+ connection.execute(
t.insert(),
- [{"id": 1, "data": "four"}, {"id": 2, "data": "three"}],
+ [
+ {"id": 1, "data": "four"},
+ {"id": 2, "data": "three"},
+ ],
)
+ else:
+ connection.execute(
+ t.insert(),
+ [{"id": 1, "data": "four"}, {"id": 2, "data": "three"}],
+ )
- eq_(
- conn.execute(t.select().order_by(t.c.id)).fetchall(),
- [(1, "four"), (2, "three")],
- )
- eq_(
- conn.execute(tbl.select().order_by(tbl.c.id)).fetchall(),
- [(1, foo_enum.three), (2, foo_enum.three)],
- )
+ eq_(
+ connection.execute(t.select().order_by(t.c.id)).fetchall(),
+ [(1, "four"), (2, "three")],
+ )
+ eq_(
+ connection.execute(tbl.select().order_by(tbl.c.id)).fetchall(),
+ [(1, foo_enum.three), (2, foo_enum.three)],
+ )
MyPickleType = None