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


##########
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:
   The reason for doing this is because sometimes, the rendered fields in case 
of sets are stringified in a different set order. Leading to comparison failure 
like this: 
   ```
   _ 
TestRenderedTaskInstanceFields.test_get_templated_fields[templated_field8-{'foo',
 'bar'}] _
   tests/models/test_renderedtifields.py:165: in test_get_templated_fields
       assert expected_rendered_field == 
rtif.rendered_fields.get("bash_command")
   E   assert equals failed
   E     "{'foo', 'bar'}"  "{'bar', 'foo'}"
   ```
   
   Example run 
https://github.com/apache/airflow/actions/runs/12313918735/job/34369300336



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