kaxil commented on code in PR #44843:
URL: https://github.com/apache/airflow/pull/44843#discussion_r1884021823


##########
tests/models/test_renderedtifields.py:
##########
@@ -158,16 +163,31 @@ def test_get_templated_fields(self, templated_field, 
expected_rendered_field, da
         assert ti.dag_id == rtif.dag_id
         assert ti.task_id == rtif.task_id
         assert ti.run_id == rtif.run_id
-        assert expected_rendered_field == 
rtif.rendered_fields.get("bash_command")
+        if type(templated_field) is set:
+            assert ast.literal_eval(expected_rendered_field) == 
ast.literal_eval(
+                rtif.rendered_fields.get("bash_command")
+            )
+        else:
+            assert expected_rendered_field == 
rtif.rendered_fields.get("bash_command")

Review Comment:
   Why this @amoghrajesh ?



##########
tests/models/test_renderedtifields.py:
##########
@@ -158,16 +163,31 @@ def test_get_templated_fields(self, templated_field, 
expected_rendered_field, da
         assert ti.dag_id == rtif.dag_id
         assert ti.task_id == rtif.task_id
         assert ti.run_id == rtif.run_id
-        assert expected_rendered_field == 
rtif.rendered_fields.get("bash_command")
+        if type(templated_field) is set:
+            assert ast.literal_eval(expected_rendered_field) == 
ast.literal_eval(
+                rtif.rendered_fields.get("bash_command")
+            )
+        else:
+            assert expected_rendered_field == 
rtif.rendered_fields.get("bash_command")
 
         session.add(rtif)
         session.flush()
 
-        assert RTIF.get_templated_fields(ti=ti, session=session) == {
-            "bash_command": expected_rendered_field,
-            "env": None,
-            "cwd": None,
-        }
+        if type(templated_field) is set:
+            expected = RTIF.get_templated_fields(ti=ti, session=session)
+            expected["bash_command"] = 
ast.literal_eval(expected["bash_command"])
+            actual = {
+                "bash_command": ast.literal_eval(expected_rendered_field),
+                "env": None,
+                "cwd": None,
+            }
+            assert expected == actual
+        else:
+            assert RTIF.get_templated_fields(ti=ti, session=session) == {
+                "bash_command": expected_rendered_field,
+                "env": None,
+                "cwd": None,
+            }

Review Comment:
   and this?



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