diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-22 10:22:18 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-22 11:02:56 -0500 |
| commit | ffc375d1f02205838485dd1e3e181037b2c0a580 (patch) | |
| tree | 8fc6312600078cead3a0e8287f536c4fa4c31303 /test/sql/test_insert.py | |
| parent | f559f378c47811b5528ad1769cb86925e85fd1e5 (diff) | |
| download | sqlalchemy-ffc375d1f02205838485dd1e3e181037b2c0a580.tar.gz | |
Repair inline flag
In 9fca5d827d we attempted to deprecate the "inline=True" flag
and add a generative inline() method, however failed to include
any tests and the method was implemented incorrectly such that
it would get overwritten with the boolean flag immediately.
Rename the internal "inline" flag to "_inline" and add test
support both for the method as well as deprecated support
for the flag, including a fixture addition to assert the expected
value of the flag as it generally does not affect the
actual compiled SQL string.
Change-Id: I0450049f17f1f0d91e22d27f1a973a2b6c0e59f7
Diffstat (limited to 'test/sql/test_insert.py')
| -rw-r--r-- | test/sql/test_insert.py | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/test/sql/test_insert.py b/test/sql/test_insert.py index f4516f942..7508ee6c7 100644 --- a/test/sql/test_insert.py +++ b/test/sql/test_insert.py @@ -135,10 +135,19 @@ class InsertTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL): ) self.assert_compile( - t.insert(inline=True, values={}), + t.insert().values({}), "INSERT INTO test (col1, col2) VALUES (foo(:foo_1), " "(SELECT coalesce(max(foo.id)) AS coalesce_1 FROM " "foo))", + inline_flag=False, + ) + + self.assert_compile( + t.insert().inline().values({}), + "INSERT INTO test (col1, col2) VALUES (foo(:foo_1), " + "(SELECT coalesce(max(foo.id)) AS coalesce_1 FROM " + "foo))", + inline_flag=True, ) def test_generic_insert_bind_params_all_columns(self): @@ -290,14 +299,29 @@ class InsertTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL): ) self.assert_compile( - table.insert(values={}, inline=True), + table.insert().values(), + "INSERT INTO sometable (foo) VALUES (foobar())", + inline_flag=False, + ) + + self.assert_compile( + table.insert(), + "INSERT INTO sometable (foo) VALUES (foobar())", + params={}, + inline_flag=False, + ) + + self.assert_compile( + table.insert().values().inline(), "INSERT INTO sometable (foo) VALUES (foobar())", + inline_flag=True, ) self.assert_compile( - table.insert(inline=True), + table.insert().inline(), "INSERT INTO sometable (foo) VALUES (foobar())", params={}, + inline_flag=True, ) def test_insert_returning_not_in_default(self): |
