diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-01-06 10:43:19 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-01-15 13:04:58 -0500 |
| commit | ebbbac0a76b3327a829864afb26ee1b7ff1dc780 (patch) | |
| tree | b086b06760255bc0bb76e51624a5e3772bc4cc3d /test/dialect | |
| parent | 6be06d85e598e4fda6f3d35084e1c5cccb30cee5 (diff) | |
| download | sqlalchemy-ebbbac0a76b3327a829864afb26ee1b7ff1dc780.tar.gz | |
update execute() arg formats in modules and tests
continuing with producing a SQLAlchemy 1.4.0b2 that internally
does not emit any of its own 2.0 deprecation warnings,
migrate the *args and **kwargs passed to execute() methods
that now must be a single list or dictionary.
Alembic 1.5 is again waiting on this internal consistency to
be present so that it can pass all tests with no 2.0
deprecation warnings.
Change-Id: If6b792e57c8c5dff205419644ab68e631575a2fa
Diffstat (limited to 'test/dialect')
| -rw-r--r-- | test/dialect/mssql/test_query.py | 11 | ||||
| -rw-r--r-- | test/dialect/mssql/test_types.py | 10 | ||||
| -rw-r--r-- | test/dialect/oracle/test_dialect.py | 4 | ||||
| -rw-r--r-- | test/dialect/oracle/test_reflection.py | 6 | ||||
| -rw-r--r-- | test/dialect/oracle/test_types.py | 16 | ||||
| -rw-r--r-- | test/dialect/postgresql/test_dialect.py | 2 | ||||
| -rw-r--r-- | test/dialect/postgresql/test_query.py | 48 | ||||
| -rw-r--r-- | test/dialect/postgresql/test_types.py | 127 | ||||
| -rw-r--r-- | test/dialect/test_sqlite.py | 18 |
9 files changed, 141 insertions, 101 deletions
diff --git a/test/dialect/mssql/test_query.py b/test/dialect/mssql/test_query.py index b806b9247..d3b2e0644 100644 --- a/test/dialect/mssql/test_query.py +++ b/test/dialect/mssql/test_query.py @@ -91,7 +91,7 @@ class IdentityInsertTest(fixtures.TablesTest, AssertsCompiledSQL): def test_insert_plain_param(self, connection): conn = connection cattable = self.tables.cattable - conn.execute(cattable.insert(), id=5) + conn.execute(cattable.insert(), dict(id=5)) eq_(conn.scalar(select(cattable.c.id)), 5) def test_insert_values_key_plain(self, connection): @@ -156,8 +156,7 @@ class QueryTest(testing.AssertsExecutionResults, fixtures.TestBase): __only_on__ = "mssql" __backend__ = True - @testing.provide_metadata - def test_fetchid_trigger(self, connection): + def test_fetchid_trigger(self, metadata, connection): # TODO: investigate test hang on mssql when connection fixture is used """ Verify identity return value on inserting to a trigger table. @@ -190,7 +189,7 @@ class QueryTest(testing.AssertsExecutionResults, fixtures.TestBase): # TODO: check whether this error also occurs with clients other # than the SQL Server Native Client. Maybe an assert_raises # test should be written. - meta = self.metadata + meta = metadata t1 = Table( "t1", meta, @@ -230,9 +229,9 @@ class QueryTest(testing.AssertsExecutionResults, fixtures.TestBase): # seems to work with all linux drivers + backend. not sure # if windows drivers / servers have different behavior here. meta.create_all(connection) - r = connection.execute(t2.insert(), descr="hello") + r = connection.execute(t2.insert(), dict(descr="hello")) eq_(r.inserted_primary_key, (200,)) - r = connection.execute(t1.insert(), descr="hello") + r = connection.execute(t1.insert(), dict(descr="hello")) eq_(r.inserted_primary_key, (100,)) @testing.provide_metadata diff --git a/test/dialect/mssql/test_types.py b/test/dialect/mssql/test_types.py index c2231d105..439828fe4 100644 --- a/test/dialect/mssql/test_types.py +++ b/test/dialect/mssql/test_types.py @@ -770,7 +770,7 @@ class TypeRoundTripTest( def test_date_roundtrips(self, date_fixture, connection): t, (d1, t1, d2) = date_fixture connection.execute( - t.insert(), adate=d1, adatetime=d2, atime1=t1, atime2=d2 + t.insert(), dict(adate=d1, adatetime=d2, atime1=t1, atime2=d2) ) row = connection.execute(t.select()).first() @@ -876,13 +876,13 @@ class TypeRoundTripTest( sa.exc.DBAPIError, connection.execute, t.insert(), - adatetimeoffset=dto_param_value, + dict(adatetimeoffset=dto_param_value), ) return connection.execute( t.insert(), - adatetimeoffset=dto_param_value, + dict(adatetimeoffset=dto_param_value), ) row = connection.execute(t.select()).first() @@ -1248,7 +1248,7 @@ class BinaryTest(fixtures.TestBase): expected = data with engine.begin() as conn: - conn.execute(binary_table.insert(), data=data) + conn.execute(binary_table.insert(), dict(data=data)) eq_(conn.scalar(select(binary_table.c.data)), expected) @@ -1263,7 +1263,7 @@ class BinaryTest(fixtures.TestBase): conn.execute(binary_table.delete()) - conn.execute(binary_table.insert(), data=None) + conn.execute(binary_table.insert(), dict(data=None)) eq_(conn.scalar(select(binary_table.c.data)), None) eq_( diff --git a/test/dialect/oracle/test_dialect.py b/test/dialect/oracle/test_dialect.py index 32234bf65..2ec306842 100644 --- a/test/dialect/oracle/test_dialect.py +++ b/test/dialect/oracle/test_dialect.py @@ -465,7 +465,7 @@ end; outparam("y_out", Float), outparam("z_out", String), ), - x_in=5, + dict(x_in=5), ) eq_(result.out_parameters, {"x_out": 10, "y_out": 75, "z_out": None}) assert isinstance(result.out_parameters["x_out"], int) @@ -527,7 +527,7 @@ class QuotedBindRoundTripTest(fixtures.TestBase): connection.execute( select(t).where(t.c.foo.in_(bindparam("uid", expanding=True))), - uid=[1, 2, 3], + dict(uid=[1, 2, 3]), ) diff --git a/test/dialect/oracle/test_reflection.py b/test/dialect/oracle/test_reflection.py index 0df4236e2..f9ce1a30b 100644 --- a/test/dialect/oracle/test_reflection.py +++ b/test/dialect/oracle/test_reflection.py @@ -668,8 +668,10 @@ class RoundTripIndexTest(fixtures.TestBase): AND owner = :owner AND constraint_type = 'P' """ ), - table_name=s_table.name.upper(), - owner=testing.db.dialect.default_schema_name.upper(), + dict( + table_name=s_table.name.upper(), + owner=testing.db.dialect.default_schema_name.upper(), + ), ) reflectedtable = inspect.tables[s_table.name] diff --git a/test/dialect/oracle/test_types.py b/test/dialect/oracle/test_types.py index 8ea7c0e04..5b92dea01 100644 --- a/test/dialect/oracle/test_types.py +++ b/test/dialect/oracle/test_types.py @@ -206,9 +206,11 @@ class TypesTest(fixtures.TestBase): t.create(connection) connection.execute( t.insert(), - dict(id=1, data=v1), - dict(id=2, data=v2), - dict(id=3, data=v3), + [ + dict(id=1, data=v1), + dict(id=2, data=v2), + dict(id=3, data=v3), + ], ) eq_( @@ -767,7 +769,7 @@ class TypesTest(fixtures.TestBase): Column("data", oracle.RAW(35)), ) metadata.create_all(connection) - connection.execute(raw_table.insert(), id=1, data=b("ABCDEF")) + connection.execute(raw_table.insert(), dict(id=1, data=b("ABCDEF"))) eq_(connection.execute(raw_table.select()).first(), (1, b("ABCDEF"))) def test_reflect_nvarchar(self, metadata, connection): @@ -842,7 +844,7 @@ class TypesTest(fixtures.TestBase): t = Table("t", metadata, Column("data", oracle.LONG)) metadata.create_all(connection) - connection.execute(t.insert(), data="xyz") + connection.execute(t.insert(), dict(data="xyz")) eq_(connection.scalar(select(t.c.data)), "xyz") def test_longstring(self, metadata, connection): @@ -858,7 +860,7 @@ class TypesTest(fixtures.TestBase): ) try: t = Table("z_test", metadata, autoload_with=connection) - connection.execute(t.insert(), id=1.0, add_user="foobar") + connection.execute(t.insert(), dict(id=1.0, add_user="foobar")) assert connection.execute(t.select()).fetchall() == [(1, "foobar")] finally: exec_sql(connection, "DROP TABLE Z_TEST") @@ -909,7 +911,7 @@ class LOBFetchTest(fixtures.TablesTest): cls.stream = stream = file_.read(12000) for i in range(1, 11): - connection.execute(binary_table.insert(), id=i, data=stream) + connection.execute(binary_table.insert(), dict(id=i, data=stream)) def test_lobs_without_convert(self): engine = testing_engine(options=dict(auto_convert_lobs=False)) diff --git a/test/dialect/postgresql/test_dialect.py b/test/dialect/postgresql/test_dialect.py index 9c9d817bb..08be41b75 100644 --- a/test/dialect/postgresql/test_dialect.py +++ b/test/dialect/postgresql/test_dialect.py @@ -1160,7 +1160,7 @@ $$ LANGUAGE plpgsql; ) t = Table("speedy_users", meta, autoload_with=connection) r = connection.execute( - t.insert(), user_name="user", user_password="lala" + t.insert(), dict(user_name="user", user_password="lala") ) eq_(r.inserted_primary_key, (1,)) result = connection.execute(t.select()).fetchall() diff --git a/test/dialect/postgresql/test_query.py b/test/dialect/postgresql/test_query.py index c51fd1943..47f86e791 100644 --- a/test/dialect/postgresql/test_query.py +++ b/test/dialect/postgresql/test_query.py @@ -180,13 +180,15 @@ class InsertTest(fixtures.TestBase, AssertsExecutionResults): conn.execute( table.insert(), - {"id": 31, "data": "d3"}, - {"id": 32, "data": "d4"}, + [ + {"id": 31, "data": "d3"}, + {"id": 32, "data": "d4"}, + ], ) # executemany, uses SERIAL - conn.execute(table.insert(), {"data": "d5"}, {"data": "d6"}) + conn.execute(table.insert(), [{"data": "d5"}, {"data": "d6"}]) # single execute, explicit id, inline @@ -252,10 +254,12 @@ class InsertTest(fixtures.TestBase, AssertsExecutionResults): eq_(r.inserted_primary_key, (5,)) conn.execute( table.insert(), - {"id": 31, "data": "d3"}, - {"id": 32, "data": "d4"}, + [ + {"id": 31, "data": "d3"}, + {"id": 32, "data": "d4"}, + ], ) - conn.execute(table.insert(), {"data": "d5"}, {"data": "d6"}) + conn.execute(table.insert(), [{"data": "d5"}, {"data": "d6"}]) conn.execute(table.insert().inline(), {"id": 33, "data": "d7"}) conn.execute(table.insert().inline(), {"data": "d8"}) @@ -320,13 +324,15 @@ class InsertTest(fixtures.TestBase, AssertsExecutionResults): conn.execute( table.insert(), - {"id": 31, "data": "d3"}, - {"id": 32, "data": "d4"}, + [ + {"id": 31, "data": "d3"}, + {"id": 32, "data": "d4"}, + ], ) # executemany, uses SERIAL - conn.execute(table.insert(), {"data": "d5"}, {"data": "d6"}) + conn.execute(table.insert(), [{"data": "d5"}, {"data": "d6"}]) # single execute, explicit id, inline @@ -392,10 +398,12 @@ class InsertTest(fixtures.TestBase, AssertsExecutionResults): eq_(r.inserted_primary_key, (5,)) conn.execute( table.insert(), - {"id": 31, "data": "d3"}, - {"id": 32, "data": "d4"}, + [ + {"id": 31, "data": "d3"}, + {"id": 32, "data": "d4"}, + ], ) - conn.execute(table.insert(), {"data": "d5"}, {"data": "d6"}) + conn.execute(table.insert(), [{"data": "d5"}, {"data": "d6"}]) conn.execute(table.insert().inline(), {"id": 33, "data": "d7"}) conn.execute(table.insert().inline(), {"data": "d8"}) @@ -451,10 +459,12 @@ class InsertTest(fixtures.TestBase, AssertsExecutionResults): conn.execute(table.insert(), {"data": "d2"}) conn.execute( table.insert(), - {"id": 31, "data": "d3"}, - {"id": 32, "data": "d4"}, + [ + {"id": 31, "data": "d3"}, + {"id": 32, "data": "d4"}, + ], ) - conn.execute(table.insert(), {"data": "d5"}, {"data": "d6"}) + conn.execute(table.insert(), [{"data": "d5"}, {"data": "d6"}]) conn.execute(table.insert().inline(), {"id": 33, "data": "d7"}) conn.execute(table.insert().inline(), {"data": "d8"}) @@ -514,10 +524,12 @@ class InsertTest(fixtures.TestBase, AssertsExecutionResults): conn.execute(table.insert(), {"data": "d2"}) conn.execute( table.insert(), - {"id": 31, "data": "d3"}, - {"id": 32, "data": "d4"}, + [ + {"id": 31, "data": "d3"}, + {"id": 32, "data": "d4"}, + ], ) - conn.execute(table.insert(), {"data": "d5"}, {"data": "d6"}) + conn.execute(table.insert(), [{"data": "d5"}, {"data": "d6"}]) conn.execute(table.insert().inline(), {"id": 33, "data": "d7"}) conn.execute(table.insert().inline(), {"data": "d8"}) diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py index 6202f8f86..b36f50408 100644 --- a/test/dialect/postgresql/test_types.py +++ b/test/dialect/postgresql/test_types.py @@ -128,7 +128,7 @@ class FloatCoercionTest(fixtures.TablesTest, AssertsExecutionResults): ) metadata.create_all(connection) connection.execute( - t1.insert(), x=[5], y=[5], z=[6], q=[decimal.Decimal("6.4")] + t1.insert(), dict(x=[5], y=[5], z=[6], q=[decimal.Decimal("6.4")]) ) row = connection.execute(t1.select()).first() eq_(row, ([5], [5], [6], [decimal.Decimal("6.4")])) @@ -144,7 +144,7 @@ class FloatCoercionTest(fixtures.TablesTest, AssertsExecutionResults): ) metadata.create_all(connection) connection.execute( - t1.insert(), x=[5], y=[5], z=[6], q=[decimal.Decimal("6.4")] + t1.insert(), dict(x=[5], y=[5], z=[6], q=[decimal.Decimal("6.4")]) ) row = connection.execute(t1.select()).first() eq_(row, ([5], [5], [6], [decimal.Decimal("6.4")])) @@ -167,9 +167,9 @@ class EnumTest(fixtures.TestBase, AssertsExecutionResults): ) t1.create(connection) t1.create(connection, checkfirst=True) # check the create - connection.execute(t1.insert(), value="two") - connection.execute(t1.insert(), value="three") - connection.execute(t1.insert(), value="three") + connection.execute(t1.insert(), dict(value="two")) + connection.execute(t1.insert(), dict(value="three")) + connection.execute(t1.insert(), dict(value="three")) eq_( connection.execute(t1.select().order_by(t1.c.id)).fetchall(), [(1, "two"), (2, "three"), (3, "three")], @@ -207,9 +207,9 @@ class EnumTest(fixtures.TestBase, AssertsExecutionResults): ] t1.create(conn, checkfirst=True) - conn.execute(t1.insert(), value="two") - conn.execute(t1.insert(), value="three") - conn.execute(t1.insert(), value="three") + conn.execute(t1.insert(), dict(value="two")) + conn.execute(t1.insert(), dict(value="three")) + conn.execute(t1.insert(), dict(value="three")) eq_( conn.execute(t1.select().order_by(t1.c.id)).fetchall(), [(1, "two"), (2, "three"), (3, "three")], @@ -245,9 +245,9 @@ class EnumTest(fixtures.TestBase, AssertsExecutionResults): ), ) metadata.create_all(connection) - connection.execute(t1.insert(), value=util.u("drôle")) - connection.execute(t1.insert(), value=util.u("réveillé")) - connection.execute(t1.insert(), value=util.u("S’il")) + connection.execute(t1.insert(), dict(value=util.u("drôle"))) + connection.execute(t1.insert(), dict(value=util.u("réveillé"))) + connection.execute(t1.insert(), dict(value=util.u("S’il"))) eq_( connection.execute(t1.select().order_by(t1.c.id)).fetchall(), [ @@ -940,7 +940,9 @@ class TimezoneTest(fixtures.TablesTest): somedate = connection.scalar(func.current_timestamp().select()) assert somedate.tzinfo - connection.execute(tztable.insert(), id=1, name="row1", date=somedate) + connection.execute( + tztable.insert(), dict(id=1, name="row1", date=somedate) + ) row = connection.execute( select(tztable.c.date).where(tztable.c.id == 1) ).first() @@ -951,7 +953,9 @@ class TimezoneTest(fixtures.TablesTest): ) result = connection.execute( tztable.update(tztable.c.id == 1).returning(tztable.c.date), - name="newname", + dict( + name="newname", + ), ) row = result.first() assert row[0] >= somedate @@ -964,7 +968,7 @@ class TimezoneTest(fixtures.TablesTest): somedate = datetime.datetime(2005, 10, 20, 11, 52, 0) assert not somedate.tzinfo connection.execute( - notztable.insert(), id=1, name="row1", date=somedate + notztable.insert(), dict(id=1, name="row1", date=somedate) ) row = connection.execute( select(notztable.c.date).where(notztable.c.id == 1) @@ -973,7 +977,9 @@ class TimezoneTest(fixtures.TablesTest): eq_(row[0].tzinfo, None) result = connection.execute( notztable.update(notztable.c.id == 1).returning(notztable.c.date), - name="newname", + dict( + name="newname", + ), ) row = result.first() assert row[0] >= somedate @@ -1324,7 +1330,7 @@ class ArrayRoundTripTest(object): ) def _fixture_456(self, table, connection): - connection.execute(table.insert(), intarr=[4, 5, 6]) + connection.execute(table.insert(), dict(intarr=[4, 5, 6])) def test_reflect_array_column(self, connection): metadata2 = MetaData() @@ -1403,8 +1409,10 @@ class ArrayRoundTripTest(object): arrtable = self.tables.arrtable connection.execute( arrtable.insert(), - intarr=[1, 2, 3], - strarr=[util.u("abc"), util.u("def")], + dict( + intarr=[1, 2, 3], + strarr=[util.u("abc"), util.u("def")], + ), ) results = connection.execute(arrtable.select()).fetchall() eq_(len(results), 1) @@ -1415,8 +1423,10 @@ class ArrayRoundTripTest(object): arrtable = self.tables.arrtable connection.execute( arrtable.insert(), - intarr=[1, None, 3], - strarr=[util.u("abc"), None], + dict( + intarr=[1, None, 3], + strarr=[util.u("abc"), None], + ), ) results = connection.execute(arrtable.select()).fetchall() eq_(len(results), 1) @@ -1427,11 +1437,13 @@ class ArrayRoundTripTest(object): arrtable = self.tables.arrtable connection.execute( arrtable.insert(), - intarr=[1, 2, 3], - strarr=[util.u("abc"), util.u("def")], + dict( + intarr=[1, 2, 3], + strarr=[util.u("abc"), util.u("def")], + ), ) connection.execute( - arrtable.insert(), intarr=[4, 5, 6], strarr=util.u("ABC") + arrtable.insert(), dict(intarr=[4, 5, 6], strarr=util.u("ABC")) ) results = connection.execute( arrtable.select().where(arrtable.c.intarr == [1, 2, 3]) @@ -1443,8 +1455,7 @@ class ArrayRoundTripTest(object): arrtable = self.tables.arrtable connection.execute( arrtable.insert(), - intarr=[1, 2, 3], - strarr=[util.u("abc"), util.u("def")], + dict(intarr=[1, 2, 3], strarr=[util.u("abc"), util.u("def")]), ) results = connection.execute( select(arrtable.c.intarr + [4, 5, 6]) @@ -1456,9 +1467,9 @@ class ArrayRoundTripTest(object): arrtable = self.tables.arrtable connection.execute( arrtable.insert(), - id=5, - intarr=[1, 2, 3], - strarr=[util.u("abc"), util.u("def")], + dict( + id=5, intarr=[1, 2, 3], strarr=[util.u("abc"), util.u("def")] + ), ) results = connection.execute( select(arrtable.c.id).where(arrtable.c.intarr < [4, 5, 6]) @@ -1470,13 +1481,17 @@ class ArrayRoundTripTest(object): arrtable = self.tables.arrtable connection.execute( arrtable.insert(), - intarr=[4, 5, 6], - strarr=[[util.ue("m\xe4\xe4")], [util.ue("m\xf6\xf6")]], + dict( + intarr=[4, 5, 6], + strarr=[[util.ue("m\xe4\xe4")], [util.ue("m\xf6\xf6")]], + ), ) connection.execute( arrtable.insert(), - intarr=[1, 2, 3], - strarr=[util.ue("m\xe4\xe4"), util.ue("m\xf6\xf6")], + dict( + intarr=[1, 2, 3], + strarr=[util.ue("m\xe4\xe4"), util.ue("m\xf6\xf6")], + ), ) results = connection.execute( arrtable.select(order_by=[arrtable.c.intarr]) @@ -1556,8 +1571,10 @@ class ArrayRoundTripTest(object): arrtable = self.tables.arrtable connection.execute( arrtable.insert(), - intarr=[4, 5, 6], - strarr=[util.u("abc"), util.u("def")], + dict( + intarr=[4, 5, 6], + strarr=[util.u("abc"), util.u("def")], + ), ) eq_(connection.scalar(select(arrtable.c.intarr[2:3])), [5, 6]) connection.execute( @@ -1567,7 +1584,9 @@ class ArrayRoundTripTest(object): def test_multi_dim_roundtrip(self, connection): arrtable = self.tables.arrtable - connection.execute(arrtable.insert(), dimarr=[[1, 2, 3], [4, 5, 6]]) + connection.execute( + arrtable.insert(), dict(dimarr=[[1, 2, 3], [4, 5, 6]]) + ) eq_( connection.scalar(select(arrtable.c.dimarr)), [[-1, 0, 1], [2, 3, 4]], @@ -1575,7 +1594,7 @@ class ArrayRoundTripTest(object): def test_array_any_exec(self, connection): arrtable = self.tables.arrtable - connection.execute(arrtable.insert(), intarr=[4, 5, 6]) + connection.execute(arrtable.insert(), dict(intarr=[4, 5, 6])) eq_( connection.scalar( select(arrtable.c.intarr).where( @@ -1587,7 +1606,7 @@ class ArrayRoundTripTest(object): def test_array_all_exec(self, connection): arrtable = self.tables.arrtable - connection.execute(arrtable.insert(), intarr=[4, 5, 6]) + connection.execute(arrtable.insert(), dict(intarr=[4, 5, 6])) eq_( connection.scalar( select(arrtable.c.intarr).where( @@ -1610,16 +1629,18 @@ class ArrayRoundTripTest(object): ) metadata.create_all(connection) connection.execute( - t1.insert(), id=1, data=["1", "2", "3"], data2=[5.4, 5.6] + t1.insert(), dict(id=1, data=["1", "2", "3"], data2=[5.4, 5.6]) ) connection.execute( - t1.insert(), id=2, data=["4", "5", "6"], data2=[1.0] + t1.insert(), dict(id=2, data=["4", "5", "6"], data2=[1.0]) ) connection.execute( t1.insert(), - id=3, - data=[["4", "5"], ["6", "7"]], - data2=[[5.4, 5.6], [1.0, 1.1]], + dict( + id=3, + data=[["4", "5"], ["6", "7"]], + data2=[[5.4, 5.6], [1.0, 1.1]], + ), ) r = connection.execute(t1.select().order_by(t1.c.id)).fetchall() @@ -1704,7 +1725,7 @@ class PGArrayRoundTripTest( def test_array_contained_by_exec(self, connection): arrtable = self.tables.arrtable - connection.execute(arrtable.insert(), intarr=[6, 5, 4]) + connection.execute(arrtable.insert(), dict(intarr=[6, 5, 4])) eq_( connection.scalar( select(arrtable.c.intarr.contained_by([4, 5, 6, 7])) @@ -1724,7 +1745,7 @@ class PGArrayRoundTripTest( def test_array_overlap_exec(self, connection): arrtable = self.tables.arrtable - connection.execute(arrtable.insert(), intarr=[4, 5, 6]) + connection.execute(arrtable.insert(), dict(intarr=[4, 5, 6])) eq_( connection.scalar( select(arrtable.c.intarr).where( @@ -2106,10 +2127,12 @@ class SpecialTypesTest(fixtures.TablesTest, ComparesTables): def test_tsvector_round_trip(self, connection, metadata): t = Table("t1", metadata, Column("data", postgresql.TSVECTOR)) t.create(connection) - connection.execute(t.insert(), data="a fat cat sat") + connection.execute(t.insert(), dict(data="a fat cat sat")) eq_(connection.scalar(select(t.c.data)), "'a' 'cat' 'fat' 'sat'") - connection.execute(t.update(), data="'a' 'cat' 'fat' 'mat' 'sat'") + connection.execute( + t.update(), dict(data="'a' 'cat' 'fat' 'mat' 'sat'") + ) eq_( connection.scalar(select(t.c.data)), @@ -2479,11 +2502,13 @@ class HStoreRoundTripTest(fixtures.TablesTest): data_table = self.tables.data_table connection.execute( data_table.insert(), - {"name": "r1", "data": {"k1": "r1v1", "k2": "r1v2"}}, - {"name": "r2", "data": {"k1": "r2v1", "k2": "r2v2"}}, - {"name": "r3", "data": {"k1": "r3v1", "k2": "r3v2"}}, - {"name": "r4", "data": {"k1": "r4v1", "k2": "r4v2"}}, - {"name": "r5", "data": {"k1": "r5v1", "k2": "r5v2"}}, + [ + {"name": "r1", "data": {"k1": "r1v1", "k2": "r1v2"}}, + {"name": "r2", "data": {"k1": "r2v1", "k2": "r2v2"}}, + {"name": "r3", "data": {"k1": "r3v1", "k2": "r3v2"}}, + {"name": "r4", "data": {"k1": "r4v1", "k2": "r4v2"}}, + {"name": "r5", "data": {"k1": "r5v1", "k2": "r5v2"}}, + ], ) def _assert_data(self, compare, conn): diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index 1926c6065..587148525 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -106,7 +106,7 @@ class TestTypes(fixtures.TestBase, AssertsExecutionResults): exc.StatementError, connection.execute, select(1).where(bindparam("date", type_=Date)), - date=str(datetime.date(2007, 10, 30)), + dict(date=str(datetime.date(2007, 10, 30))), ) def test_cant_parse_datetime_message(self, connection): @@ -305,7 +305,7 @@ class JSONTest(fixtures.TestBase): value = {"json": {"foo": "bar"}, "recs": ["one", "two"]} - connection.execute(sqlite_json.insert(), foo=value) + connection.execute(sqlite_json.insert(), dict(foo=value)) eq_(connection.scalar(select(sqlite_json.c.foo)), value) @@ -316,7 +316,7 @@ class JSONTest(fixtures.TestBase): value = {"json": {"foo": "bar"}} - connection.execute(sqlite_json.insert(), foo=value) + connection.execute(sqlite_json.insert(), dict(foo=value)) eq_( connection.scalar(select(sqlite_json.c.foo["json"])), value["json"] @@ -2397,11 +2397,11 @@ class SavepointTest(fixtures.TablesTest): users = self.tables.users connection = self.bind.connect() transaction = connection.begin() - connection.execute(users.insert(), user_id=1, user_name="user1") + connection.execute(users.insert(), dict(user_id=1, user_name="user1")) trans2 = connection.begin_nested() - connection.execute(users.insert(), user_id=2, user_name="user2") + connection.execute(users.insert(), dict(user_id=2, user_name="user2")) trans2.rollback() - connection.execute(users.insert(), user_id=3, user_name="user3") + connection.execute(users.insert(), dict(user_id=3, user_name="user3")) transaction.commit() eq_( connection.execute( @@ -2415,11 +2415,11 @@ class SavepointTest(fixtures.TablesTest): users = self.tables.users connection = self.bind.connect() transaction = connection.begin() - connection.execute(users.insert(), user_id=1, user_name="user1") + connection.execute(users.insert(), dict(user_id=1, user_name="user1")) trans2 = connection.begin_nested() - connection.execute(users.insert(), user_id=2, user_name="user2") + connection.execute(users.insert(), dict(user_id=2, user_name="user2")) trans2.commit() - connection.execute(users.insert(), user_id=3, user_name="user3") + connection.execute(users.insert(), dict(user_id=3, user_name="user3")) transaction.commit() eq_( connection.execute( |
