kiran2706 commented on code in PR #46929:
URL: https://github.com/apache/airflow/pull/46929#discussion_r2069925106
##########
airflow-core/tests/unit/models/test_xcom.py:
##########
@@ -333,6 +333,26 @@ def test_xcom_get_many_from_prior_dates(self, session,
tis_for_xcom_get_many_fro
)
assert [x.logical_date for x in stored_xcoms] == [ti2.logical_date,
ti1.logical_date]
+ def test_xcom_get_invalid_key(self, session, task_instance):
+ """Test that getting an XCom with an invalid key raises a
ValueError."""
+ with pytest.raises(ValueError, match="XCom key must be a non-empty
string. Received: ''"):
+ XComModel.get_many(
+ key="", # Invalid key
+ dag_ids=task_instance.dag_id,
+ task_ids=task_instance.task_id,
+ run_id=task_instance.run_id,
+ session=session,
+ )
+
+ with pytest.raises(ValueError, match="XCom key must be a non-empty
string. Received: None"):
+ XComModel.get_many(
+ key=None, # Invalid key
+ dag_ids=task_instance.dag_id,
+ task_ids=task_instance.task_id,
+ run_id=task_instance.run_id,
+ session=session,
+ )
+
Review Comment:
Hi @jason810496, the issue with the failing test has been fixed. Please
review it again and let me know if everything looks good. Thanks!
<img width="749" alt="image"
src="https://github.com/user-attachments/assets/323a2e3e-7980-4ddb-82f3-6e86a61b595a"
/>
--
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]