superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnbod...@apache.org
Subject [incubator-superset] branch master updated: [fix] Adding space after -- for SQL comments (#7897)
Date Thu, 18 Jul 2019 20:17:34 GMT
This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new ccedbea  [fix] Adding space after -- for SQL comments (#7897)
ccedbea is described below

commit ccedbea506dbe4ff4cda475d31c9d7ec7b5282fc
Author: John Bodley <4567245+john-bodley@users.noreply.github.com>
AuthorDate: Thu Jul 18 13:17:26 2019 -0700

    [fix] Adding space after -- for SQL comments (#7897)
---
 tests/model_tests.py     | 6 +++---
 tests/sql_parse_tests.py | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/model_tests.py b/tests/model_tests.py
index febf198..7acd4b6 100644
--- a/tests/model_tests.py
+++ b/tests/model_tests.py
@@ -262,14 +262,14 @@ class SqlaTableModelTestCase(SupersetTestCase):
             extras={},
         )
         sql = tbl.get_query_str(query_obj)
-        self.assertNotIn("--COMMENT", sql)
+        self.assertNotIn("-- COMMENT", sql)
 
         def mutator(*args):
-            return "--COMMENT\n" + args[0]
+            return "-- COMMENT\n" + args[0]
 
         app.config["SQL_QUERY_MUTATOR"] = mutator
         sql = tbl.get_query_str(query_obj)
-        self.assertIn("--COMMENT", sql)
+        self.assertIn("-- COMMENT", sql)
 
         app.config["SQL_QUERY_MUTATOR"] = None
 
diff --git a/tests/sql_parse_tests.py b/tests/sql_parse_tests.py
index f9a1279..a7f925c 100644
--- a/tests/sql_parse_tests.py
+++ b/tests/sql_parse_tests.py
@@ -449,13 +449,13 @@ class SupersetTestCase(unittest.TestCase):
         self.assertEquals({"SalesOrderHeader"}, self.extract_tables(query))
 
     def test_get_query_with_new_limit_comment(self):
-        sql = "SELECT * FROM ab_user --SOME COMMENT"
+        sql = "SELECT * FROM ab_user -- SOME COMMENT"
         parsed = sql_parse.ParsedQuery(sql)
         newsql = parsed.get_query_with_new_limit(1000)
         self.assertEquals(newsql, sql + "\nLIMIT 1000")
 
     def test_get_query_with_new_limit_comment_with_limit(self):
-        sql = "SELECT * FROM ab_user --SOME COMMENT WITH LIMIT 555"
+        sql = "SELECT * FROM ab_user -- SOME COMMENT WITH LIMIT 555"
         parsed = sql_parse.ParsedQuery(sql)
         newsql = parsed.get_query_with_new_limit(1000)
         self.assertEquals(newsql, sql + "\nLIMIT 1000")


Mime
View raw message