瀏覽代碼

improoving the unit test as code changed in main file as we are always trimming the semicolon like hs2 (get_current_statement fu doing this)

ayush.goyal 4 年之前
父節點
當前提交
9b9695c54b

+ 0 - 3
desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py

@@ -242,9 +242,6 @@ class SqlAlchemyApi(Api):
     stmt_dict = self._get_current_statement(notebook, snippet)
     statement = stmt_dict['statement']
 
-    if self.interpreter['dialect_properties'].get('trim_statement_semicolon', True):
-      statement = statement.strip().rstrip(';')
-
     if self.interpreter['dialect_properties'].get('has_use_statement') and snippet.get('database'):
       connection.execute(
         'USE %(sql_identifier_quote)s%(database)s%(sql_identifier_quote)s' % {

+ 1 - 10
desktop/libs/notebook/src/notebook/connectors/sql_alchemy_tests.py

@@ -344,22 +344,13 @@ class TestApi(object):
             execute=execute
           )
           notebook = {}
-          snippet = {'statement': 'SELECT 1;'}
+          snippet = {'statement': 'SELECT 1;', 'result': {}}
 
           # Trim
           engine = SqlAlchemyApi(self.user, interpreter).execute(notebook, snippet)
 
           execute.assert_called_with('SELECT 1')
 
-          # No Trim
-          interpreter['options']['url'] = 'mysql://hue:3306/hue'
-          interpreter['dialect_properties']['trim_statement_semicolon'] = False
-          interpreter['dialect_properties']['sql_identifier_quote'] = '`'
-
-          engine = SqlAlchemyApi(self.user, interpreter).execute(notebook, snippet)
-
-          execute.assert_called_with('SELECT 1;')
-
 
   def test_get_log(self):
     notebook = Mock()