diff options
author | Gord Thompson <gord@gordthompson.com> | 2020-07-17 18:06:41 -0600 |
---|---|---|
committer | Gord Thompson <gord@gordthompson.com> | 2020-07-18 06:49:19 -0600 |
commit | 547e959157f841f4f6d1e405ceed14755fcbd0bd (patch) | |
tree | 99e288566eaeb65d62b37424bc6aaa7c4149b8e5 /test/dialect/mssql/test_compiler.py | |
parent | 4d277a24652c1092b2bacd73dbb6b465a5554594 (diff) | |
download | sqlalchemy-547e959157f841f4f6d1e405ceed14755fcbd0bd.tar.gz |
Fix mssql dialect escaping object names containing ']'
Fixes: #5467
Change-Id: I054ec219717ba62847a9daf1214e215dd6b70633
Diffstat (limited to 'test/dialect/mssql/test_compiler.py')
-rw-r--r-- | test/dialect/mssql/test_compiler.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/test/dialect/mssql/test_compiler.py b/test/dialect/mssql/test_compiler.py index 732ff1f55..83a610888 100644 --- a/test/dialect/mssql/test_compiler.py +++ b/test/dialect/mssql/test_compiler.py @@ -40,10 +40,23 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): self.assert_compile(sql.false(), "0") self.assert_compile(sql.true(), "1") - def test_select(self): - t = table("sometable", column("somecolumn")) + @testing.combinations( + ("plain", "sometable", "sometable"), + ("matched_square_brackets", "colo[u]r", "[colo[u]]r]"), + ("unmatched_left_square_bracket", "colo[ur", "[colo[ur]"), + ("unmatched_right_square_bracket", "colou]r", "[colou]]r]"), + ("double quotes", 'Edwin "Buzz" Aldrin', '[Edwin "Buzz" Aldrin]'), + ("dash", "Dash-8", "[Dash-8]"), + ("slash", "tl/dr", "[tl/dr]"), + ("space", "Red Deer", "[Red Deer]"), + ("question mark", "OK?", "[OK?]"), + ("percent", "GST%", "[GST%]"), + id_="iaa", + ) + def test_identifier_rendering(self, table_name, rendered_name): + t = table(table_name, column("somecolumn")) self.assert_compile( - t.select(), "SELECT sometable.somecolumn FROM sometable" + t.select(), "SELECT {0}.somecolumn FROM {0}".format(rendered_name) ) def test_select_with_nolock(self): |