Lee-W commented on code in PR #70974:
URL: https://github.com/apache/airflow/pull/70974#discussion_r3702650094
##########
task-sdk/src/airflow/sdk/serde/__init__.py:
##########
@@ -285,7 +285,11 @@ def serialize(o: object, depth: int = 0) -> U | None:
dct[DATA] = serialize(data, depth + 1)
return dct
- raise TypeError(f"cannot serialize object of type {cls}")
+ raise TypeError(
+ f"cannot serialize object of type {cls}. Give it a `serialize()`
method (and a matching "
Review Comment:
```suggestion
f"Cannot serialize object of type {cls}. Give it a `serialize()`
method (and a matching "
```
##########
task-sdk/tests/task_sdk/serde/test_serde.py:
##########
@@ -646,5 +648,7 @@ def test_error_when_serializing_callable_without_name(self):
with pytest.raises(
TypeError,
match="cannot serialize object of type <class
'tests.task_sdk.serde.test_serde.C'>",
- ):
+ ) as exc_info:
serialize(i)
+ assert "@dataclass or @attr.define" in str(exc_info.value)
Review Comment:
same here
##########
task-sdk/tests/task_sdk/serde/test_serde.py:
##########
@@ -523,8 +523,10 @@ def test_raise_undeserializable(self):
"__version__": 0,
}
)
- with pytest.raises(TypeError, match="No deserializer"):
+ with pytest.raises(TypeError, match="No deserializer") as exc_info:
deserialize(data)
+ assert "deserialize(data, version)" in str(exc_info.value)
Review Comment:
would be better if we check the whole sentence instead
--
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]