mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-30 23:02:50 +00:00
fix: deflake MemoryRecord embedding serialization test
Substring checks like `'0.1' not in json_str` collided with timestamps such as `2026-04-10T13:00:50.140557` on CI. Round-trip through `model_validate_json` to verify structurally that the embedding field is absent from the serialized output.
This commit is contained in:
@@ -51,14 +51,13 @@ def test_memory_record_embedding_excluded_from_serialization() -> None:
|
||||
dumped = r.model_dump()
|
||||
assert "embedding" not in dumped
|
||||
assert dumped["content"] == "hello"
|
||||
|
||||
# model_dump_json excludes embedding
|
||||
json_str = r.model_dump_json()
|
||||
assert "0.1" not in json_str
|
||||
assert "embedding" not in json_str
|
||||
rehydrated = MemoryRecord.model_validate_json(json_str)
|
||||
assert rehydrated.embedding is None
|
||||
|
||||
# repr excludes embedding
|
||||
assert "0.1" not in repr(r)
|
||||
assert "embedding=" not in repr(r)
|
||||
|
||||
# Direct attribute access still works for storage layer
|
||||
assert r.embedding is not None
|
||||
|
||||
Reference in New Issue
Block a user