xBis7 commented on code in PR #72458:
URL: https://github.com/apache/airflow/pull/72458#discussion_r3948363434


##########
shared/observability/tests/observability/test_attributes.py:
##########
@@ -0,0 +1,49 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import pytest
+
+from airflow_shared.observability.attributes import expand_dag_tags
+
+
[email protected](
+    ("tag_names", "expected"),
+    [
+        pytest.param([], {}, id="empty"),
+        pytest.param(["production"], {"production": ""}, id="standalone"),
+        pytest.param(["env:prod"], {"env": "prod"}, id="key-value"),
+        pytest.param(
+            ["production", "env:prod", "team:data"],
+            {"production": "", "env": "prod", "team": "data"},
+            id="mixed",
+        ),
+        pytest.param(["a:b:c"], {"a": "b:c"}, id="value-with-colon"),
+        pytest.param(["env:"], {"env": ""}, id="trailing-colon"),
+    ],
+)
+def test_expand_dag_tags(tag_names: list[str], expected: dict[str, str]) -> 
None:
+    assert expand_dag_tags(tag_names) == expected
+
+
+def test_expand_dag_tags_accepts_generator() -> None:
+    assert expand_dag_tags(name for name in ["env:prod"]) == {"env": "prod"}
+
+
+def test_expand_dag_tags_preserves_legacy_collision_behavior() -> None:

Review Comment:
   What do you mean by the term `legacy`? Here you are testing that newer 
values in the provided tags win, right?



##########
task-sdk/tests/task_sdk/execution_time/test_task_runner_dag_tags.py:
##########
@@ -0,0 +1,48 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review Comment:
   I think it makes more sense to create a class under `test_task_runner.py` 
rather than moving them to a new file. It keeps diffs simpler.



##########
shared/observability/src/airflow_shared/observability/attributes.py:
##########
@@ -0,0 +1,28 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review Comment:
   We already have a `common.py` file.
   
   
https://github.com/realtimetodie/apache-airflow/blob/51d222ac45deea423573adc4556965041a8da196/shared/observability/src/airflow_shared/observability/common.py
   
   Unless this file ends up containing multiple attribute related methods, 
there isn't a reason to have a separate file just for 1 utils function.



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