You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "hussein-awala (via GitHub)" <gi...@apache.org> on 2023/06/14 12:21:38 UTC

[GitHub] [airflow] hussein-awala commented on a diff in pull request #31866: Decode old Xcom value from airflow 2.5.2

hussein-awala commented on code in PR #31866:
URL: https://github.com/apache/airflow/pull/31866#discussion_r1229519074


##########
tests/utils/test_json.py:
##########
@@ -111,6 +111,23 @@ def test_encode_xcom_with_nested_dict(self, data):
         e = json.loads(i, cls=utils_json.XComDecoder)
         assert data == e
 
+    @pytest.mark.parametrize(
+        "data",
+        [
+            '[{"__classname__": "airflow.datasets.Dataset", "__version__": 1,'
+            ' "__data__": {"__var": {"uri": "bq://google_cloud_default@?table=table_name&schema=schema_name",'
+            ' "extra": null}, "__type": "dict"}}]'
+        ],
+    )
+    def test_decode_xcom_with_old_data(self, data):
+        """
+        Ensure that the Xcom value encoded by Airflow 2.5.2 is getting decoded by Airflow 2.6.
+        """
+        d = json.loads(data, cls=utils_json.XComDecoder)
+        assert d == [
+            Dataset(uri="bq://google_cloud_default@?table=table_name&schema=schema_name", extra=None)
+        ]
+

Review Comment:
   If there is a test for the old code, this test should be moved to that test, and if not, we need to add a new test case in this one to cover the "else" block



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org