diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-07-04 15:54:29 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-04-05 12:18:36 -0400 |
| commit | 86ef507cc73ee4a0a104b334d7ce08ad045e0c76 (patch) | |
| tree | a077e8f2de416e7a2affb898a13982f8136ad8ba /test/sql/test_operators.py | |
| parent | 87b1404eda0f6d2e99b3b2a01ae1c641fbe91311 (diff) | |
| download | sqlalchemy-86ef507cc73ee4a0a104b334d7ce08ad045e0c76.tar.gz | |
Double percent signs based on paramstyle, not dialect
This patch moves the "doubling" of percent signs into
the base compiler and makes it completely a product
of whether or not the paramstyle is format/pyformat or
not. Without this paramstyle, percent signs
are not doubled across text(), literal_column(), and
column().
Change-Id: Ie2f278ab1dbb94b5078f85c0096d74dbfa049197
Fixes: #3740
Diffstat (limited to 'test/sql/test_operators.py')
| -rw-r--r-- | test/sql/test_operators.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index 7c3ce1389..217af4337 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -2258,56 +2258,56 @@ class ComposedLikeOperatorsTest(fixtures.TestBase, testing.AssertsCompiledSQL): def test_contains(self): self.assert_compile( column('x').contains('y'), - "x LIKE '%%' || :x_1 || '%%'", + "x LIKE '%' || :x_1 || '%'", checkparams={'x_1': 'y'} ) def test_contains_escape(self): self.assert_compile( column('x').contains('a%b_c', escape='\\'), - "x LIKE '%%' || :x_1 || '%%' ESCAPE '\\'", + "x LIKE '%' || :x_1 || '%' ESCAPE '\\'", checkparams={'x_1': 'a%b_c'} ) def test_contains_autoescape(self): self.assert_compile( column('x').contains('a%b_c', autoescape='\\'), - "x LIKE '%%' || :x_1 || '%%' ESCAPE '\\'", + "x LIKE '%' || :x_1 || '%' ESCAPE '\\'", checkparams={'x_1': 'a\\%b\\_c'} ) def test_contains_literal(self): self.assert_compile( column('x').contains(literal_column('y')), - "x LIKE '%%' || y || '%%'", + "x LIKE '%' || y || '%'", checkparams={} ) def test_contains_text(self): self.assert_compile( column('x').contains(text('y')), - "x LIKE '%%' || y || '%%'", + "x LIKE '%' || y || '%'", checkparams={} ) def test_not_contains(self): self.assert_compile( ~column('x').contains('y'), - "x NOT LIKE '%%' || :x_1 || '%%'", + "x NOT LIKE '%' || :x_1 || '%'", checkparams={'x_1': 'y'} ) def test_not_contains_escape(self): self.assert_compile( ~column('x').contains('a%b_c', escape='\\'), - "x NOT LIKE '%%' || :x_1 || '%%' ESCAPE '\\'", + "x NOT LIKE '%' || :x_1 || '%' ESCAPE '\\'", checkparams={'x_1': 'a%b_c'} ) def test_not_contains_autoescape(self): self.assert_compile( ~column('x').contains('a%b_c', autoescape='\\'), - "x NOT LIKE '%%' || :x_1 || '%%' ESCAPE '\\'", + "x NOT LIKE '%' || :x_1 || '%' ESCAPE '\\'", checkparams={'x_1': 'a\\%b\\_c'} ) @@ -2402,56 +2402,56 @@ class ComposedLikeOperatorsTest(fixtures.TestBase, testing.AssertsCompiledSQL): def test_startswith(self): self.assert_compile( column('x').startswith('y'), - "x LIKE :x_1 || '%%'", + "x LIKE :x_1 || '%'", checkparams={'x_1': 'y'} ) def test_startswith_escape(self): self.assert_compile( column('x').startswith('a%b_c', escape='\\'), - "x LIKE :x_1 || '%%' ESCAPE '\\'", + "x LIKE :x_1 || '%' ESCAPE '\\'", checkparams={'x_1': 'a%b_c'} ) def test_startswith_autoescape(self): self.assert_compile( column('x').startswith('a%b_c', autoescape='\\'), - "x LIKE :x_1 || '%%' ESCAPE '\\'", + "x LIKE :x_1 || '%' ESCAPE '\\'", checkparams={'x_1': 'a\\%b\\_c'} ) def test_not_startswith(self): self.assert_compile( ~column('x').startswith('y'), - "x NOT LIKE :x_1 || '%%'", + "x NOT LIKE :x_1 || '%'", checkparams={'x_1': 'y'} ) def test_not_startswith_escape(self): self.assert_compile( ~column('x').startswith('a%b_c', escape='\\'), - "x NOT LIKE :x_1 || '%%' ESCAPE '\\'", + "x NOT LIKE :x_1 || '%' ESCAPE '\\'", checkparams={'x_1': 'a%b_c'} ) def test_not_startswith_autoescape(self): self.assert_compile( ~column('x').startswith('a%b_c', autoescape='\\'), - "x NOT LIKE :x_1 || '%%' ESCAPE '\\'", + "x NOT LIKE :x_1 || '%' ESCAPE '\\'", checkparams={'x_1': 'a\\%b\\_c'} ) def test_startswith_literal(self): self.assert_compile( column('x').startswith(literal_column('y')), - "x LIKE y || '%%'", + "x LIKE y || '%'", checkparams={} ) def test_startswith_text(self): self.assert_compile( column('x').startswith(text('y')), - "x LIKE y || '%%'", + "x LIKE y || '%'", checkparams={} ) @@ -2506,56 +2506,56 @@ class ComposedLikeOperatorsTest(fixtures.TestBase, testing.AssertsCompiledSQL): def test_endswith(self): self.assert_compile( column('x').endswith('y'), - "x LIKE '%%' || :x_1", + "x LIKE '%' || :x_1", checkparams={'x_1': 'y'} ) def test_endswith_escape(self): self.assert_compile( column('x').endswith('a%b_c', escape='\\'), - "x LIKE '%%' || :x_1 ESCAPE '\\'", + "x LIKE '%' || :x_1 ESCAPE '\\'", checkparams={'x_1': 'a%b_c'} ) def test_endswith_autoescape(self): self.assert_compile( column('x').endswith('a%b_c', autoescape='\\'), - "x LIKE '%%' || :x_1 ESCAPE '\\'", + "x LIKE '%' || :x_1 ESCAPE '\\'", checkparams={'x_1': 'a\\%b\\_c'} ) def test_not_endswith(self): self.assert_compile( ~column('x').endswith('y'), - "x NOT LIKE '%%' || :x_1", + "x NOT LIKE '%' || :x_1", checkparams={'x_1': 'y'} ) def test_not_endswith_escape(self): self.assert_compile( ~column('x').endswith('a%b_c', escape='\\'), - "x NOT LIKE '%%' || :x_1 ESCAPE '\\'", + "x NOT LIKE '%' || :x_1 ESCAPE '\\'", checkparams={'x_1': 'a%b_c'} ) def test_not_endswith_autoescape(self): self.assert_compile( ~column('x').endswith('a%b_c', autoescape='\\'), - "x NOT LIKE '%%' || :x_1 ESCAPE '\\'", + "x NOT LIKE '%' || :x_1 ESCAPE '\\'", checkparams={'x_1': 'a\\%b\\_c'} ) def test_endswith_literal(self): self.assert_compile( column('x').endswith(literal_column('y')), - "x LIKE '%%' || y", + "x LIKE '%' || y", checkparams={} ) def test_endswith_text(self): self.assert_compile( column('x').endswith(text('y')), - "x LIKE '%%' || y", + "x LIKE '%' || y", checkparams={} ) |
