Vasu-Madaan commented on code in PR #53477:
URL: https://github.com/apache/airflow/pull/53477#discussion_r2454324784
##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py:
##########
@@ -1639,6 +1639,32 @@ def test_task_id_as_name_dag_id_is_ignored(self):
pod = k.build_pod_request_obj({})
assert re.match(r"a-very-reasonable-task-name-[a-z0-9-]+",
pod.metadata.name) is not None
+ def test_normalize_labels_dict_empty(self):
+ """normalize_labels_dict should return empty dict unchanged"""
+ from airflow.providers.cncf.kubernetes.operators.pod import
normalize_labels_dict
+
+ labels = {}
+ assert normalize_labels_dict(labels) == {}
+
+ def test_normalize_labels_dict_with_none(self):
+ """normalize_labels_dict should convert None values to empty strings"""
+ from airflow.providers.cncf.kubernetes.operators.pod import
normalize_labels_dict
+
+ labels = {"a": None, "b": "value", "c": None}
+ normalized = normalize_labels_dict(labels)
+ assert normalized == {"a": "", "b": "value", "c": ""}
+
+ def test_normalize_labels_dict_preserve_other_values(self):
+ """normalize_labels_dict should preserve falsy but non-None values"""
+ from airflow.providers.cncf.kubernetes.operators.pod import
normalize_labels_dict
+
+ labels = {"empty_str": "", "zero": 0, "false": False, "none": None}
+ normalized = normalize_labels_dict(labels)
+ assert normalized["empty_str"] == ""
+ assert normalized["zero"] == 0
+ assert normalized["false"] is False
+ assert normalized["none"] == ""
Review Comment:
<img width="1592" height="182" alt="image"
src="https://github.com/user-attachments/assets/87b91f1c-8790-4835-ba16-fd12c2f931d6"
/>
Done
--
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]