diff options
| author | Gord Thompson <gord@gordthompson.com> | 2021-07-25 13:16:31 -0600 |
|---|---|---|
| committer | Gord Thompson <gord@gordthompson.com> | 2021-07-26 10:08:30 -0600 |
| commit | c6b1d24fe71c22e4d2117d084f06df3597671985 (patch) | |
| tree | 5f68c860d9ea12d139baf8badefe49c99904b11d /lib/sqlalchemy/testing | |
| parent | 6bc755d2ab9235ce4c3670ed3c3c3799d6c4ad5e (diff) | |
| download | sqlalchemy-c6b1d24fe71c22e4d2117d084f06df3597671985.tar.gz | |
Modernize tests - dml_whereclause
Fixed issue where the unit of work would internally use a 2.0-deprecated
SQL expression form, emitting a deprecation warning when SQLALCHEMY_WARN_20
were enabled.
Fixes: #6812
Change-Id: I0a031e728527a1c3382848b6ddc793939362b128
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_rowcount.py | 13 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/warnings.py | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_rowcount.py b/lib/sqlalchemy/testing/suite/test_rowcount.py index 504ac13a5..82e831f49 100644 --- a/lib/sqlalchemy/testing/suite/test_rowcount.py +++ b/lib/sqlalchemy/testing/suite/test_rowcount.py @@ -69,7 +69,8 @@ class RowCountTest(fixtures.TablesTest): # WHERE matches 3, 3 rows changed department = employees_table.c.department r = connection.execute( - employees_table.update(department == "C"), {"department": "Z"} + employees_table.update().where(department == "C"), + {"department": "Z"}, ) assert r.rowcount == 3 @@ -80,7 +81,8 @@ class RowCountTest(fixtures.TablesTest): department = employees_table.c.department r = connection.execute( - employees_table.update(department == "C"), {"department": "C"} + employees_table.update().where(department == "C"), + {"department": "C"}, ) eq_(r.rowcount, 3) @@ -90,7 +92,8 @@ class RowCountTest(fixtures.TablesTest): department = employees_table.c.department stmt = ( - employees_table.update(department == "C") + employees_table.update() + .where(department == "C") .values(name=employees_table.c.department + "Z") .return_defaults() ) @@ -117,7 +120,9 @@ class RowCountTest(fixtures.TablesTest): # WHERE matches 3, 3 rows deleted department = employees_table.c.department - r = connection.execute(employees_table.delete(department == "C")) + r = connection.execute( + employees_table.delete().where(department == "C") + ) eq_(r.rowcount, 3) @testing.requires.sane_multi_rowcount diff --git a/lib/sqlalchemy/testing/warnings.py b/lib/sqlalchemy/testing/warnings.py index 54cf7589f..39dc7da58 100644 --- a/lib/sqlalchemy/testing/warnings.py +++ b/lib/sqlalchemy/testing/warnings.py @@ -76,8 +76,6 @@ def setup_filters(): # # DML # - r"The (?:update|delete).whereclause parameter will be removed in " - "SQLAlchemy 2.0.", r"The (?:insert|update).values parameter will be removed in " "SQLAlchemy 2.0.", r"The update.preserve_parameter_order parameter will be removed in " |
