bito-code-review[bot] commented on code in PR #41426:
URL: https://github.com/apache/superset/pull/41426#discussion_r3478173633


##########
tests/unit_tests/models/test_validate_expression.py:
##########
@@ -105,18 +106,17 @@ def test_validate_having_expression(self, mock_execute):
 
     
@patch("superset.connectors.sqla.models.SqlaTable._execute_validation_query")
     def test_validate_invalid_expression(self, mock_execute):
-        """Test validation of invalid SQL expressions"""
-        # Mock _execute_validation_query to raise an exception
-        mock_execute.side_effect = Exception("Invalid SQL syntax")
-
+        """Unparseable SQL is rejected by the shared expression parser before 
the
+        validation query is built or executed."""
         result = self.table.validate_expression(
             expression="INVALID SQL HERE",
             expression_type=SqlExpressionType.COLUMN,
         )
 
         assert result["valid"] is False
         assert len(result["errors"]) == 1
-        assert "Invalid SQL syntax" in result["errors"][0]["message"]
+        assert result["errors"][0]["message"]

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Weak test assertion regression</b></div>
   <div id="fix">
   
   The assertion `assert result["errors"][0]["message"]` is too weak — it only 
checks that the error message is truthy (non-empty string) rather than 
verifying it contains the expected parse error. The original test correctly 
verified `assert "Invalid SQL syntax" in result["errors"][0]["message"]`. As 
documented in rule 6262, tests should verify actual business logic, not merely 
confirm that a component runs without errors.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #3a8ef9</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to