Jkhall81 commented on code in PR #60008:
URL: https://github.com/apache/airflow/pull/60008#discussion_r2656758999


##########
airflow-core/tests/unit/api_fastapi/common/test_parameters.py:
##########
@@ -99,3 +100,26 @@ def test_sort_param_max_number_of_filers(self):
             ),
         ):
             param.to_orm(None)
+
+
+class TestSearchParam:
+    def test_to_orm_single_value(self):
+        """Test search with a single term."""
+        param = _SearchParam(DagModel.dag_id).set_value("example_bash")
+        statement = select(DagModel)
+        statement = param.to_orm(statement)
+
+        sql = str(statement.compile(compile_kwargs={"literal_binds": 
True})).lower()
+        assert "dag_id" in sql
+        assert "like" in sql
+
+    def test_to_orm_multiple_values_or(self):
+        """Test search with multiple terms using the pipe | operator."""
+        param = _SearchParam(DagModel.dag_id).set_value("example_bash | 
example_python")
+        statement = select(DagModel)
+        statement = param.to_orm(statement)
+
+        sql = str(statement.compile(compile_kwargs={"literal_binds": True}))
+        assert "OR" in sql
+        assert "example_bash" in sql
+        assert "example_python" in sql

Review Comment:
   I'm happy to make that change if that's the preferred standard.  Since you 
mentioned deferring to @pierrejeambrun for the final call, I'll hold off on the 
refactor until he weighs in on the interface overall. That way, I can tackle 
all the feedback at once and avoid having to possibly redo the assertions, or 
other things, if he has a different preference.  Does that work for you?



-- 
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]

Reply via email to