This is an automated email from the ASF dual-hosted git repository.

uranusjr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 8168358aea9 Add test for forced stringification (#55950)
8168358aea9 is described below

commit 8168358aea9bd62ccb91074ceea32ef3bece7906
Author: Tzu-ping Chung <[email protected]>
AuthorDate: Wed Sep 24 15:09:45 2025 +0900

    Add test for forced stringification (#55950)
---
 .../api_fastapi/core_api/routes/public/test_xcom.py    | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_xcom.py 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_xcom.py
index 38ca7f48c73..cd4f497005a 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_xcom.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_xcom.py
@@ -29,7 +29,7 @@ from airflow.models.dagrun import DagRun
 from airflow.models.taskinstance import TaskInstance
 from airflow.models.xcom import XComModel
 from airflow.providers.standard.operators.empty import EmptyOperator
-from airflow.sdk import DAG
+from airflow.sdk import DAG, AssetAlias
 from airflow.sdk.bases.xcom import BaseXCom
 from airflow.sdk.execution_time.xcom import resolve_xcom_backend
 from airflow.utils.session import provide_session
@@ -194,6 +194,22 @@ class TestGetXComEntry(TestXComEndpoint):
         assert response.status_code == 200
         assert response.json()["value"] == expected_value
 
+    @pytest.mark.parametrize(
+        "xcom_value, expected_return",
+        [
+            pytest.param(42, 42, id="jsonable"),
+            pytest.param(AssetAlias("x"), "AssetAlias(name='x', 
group='asset')", id="nonjsonable"),
+            pytest.param([42, AssetAlias("x")], [42, "AssetAlias(name='x', 
group='asset')"], id="nested"),
+        ],
+    )
+    def test_stringify_false(self, test_client, xcom_value, expected_return):
+        XComModel.set(TEST_XCOM_KEY, xcom_value, dag_id=TEST_DAG_ID, 
task_id=TEST_TASK_ID, run_id=run_id)
+
+        url = 
f"/dags/{TEST_DAG_ID}/dagRuns/{run_id}/taskInstances/{TEST_TASK_ID}/xcomEntries/{TEST_XCOM_KEY}"
+        response = test_client.get(url, params={"deserialize": True, 
"stringify": False})
+        assert response.status_code == 200
+        assert response.json()["value"] == expected_return
+
 
 class TestGetXComEntries(TestXComEndpoint):
     @pytest.fixture(autouse=True)

Reply via email to