You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/03/04 19:57:58 UTC

[GitHub] [airflow] blag commented on a change in pull request #22000: Don't validate that Params are JSON when NOTSET

blag commented on a change in pull request #22000:
URL: https://github.com/apache/airflow/pull/22000#discussion_r819870455



##########
File path: tests/models/test_param.py
##########
@@ -272,7 +273,24 @@ def return_num(num):
         ti = dr.get_task_instances()[0]
         assert ti.xcom_pull() == 'test'
 
-    def test_param_non_json_serializable(self):
+    @pytest.mark.parametrize(
+        'default, should_warn',
+        [
+            pytest.param(
+                {0, 1, 2},
+                True,
+                id='default-non-JSON-serializable',
+            ),
+            pytest.param(None, False, id='default-None'),  # Param init should not warn
+            pytest.param({"b": 1}, False, id='default-JSON-serializable'),  # Param init should not warn
+        ],
+    )
+    def test_param_json_warning(self, default, should_warn):
+        warning_msg = 'The use of non-json-serializable params is deprecated'

Review comment:
       Can you also use this in the second context manager (currently line 295)?
   
   ```python
   with pytest.warns(DeprecationWarning, match=warning_msg):
   ```




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