MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / test_writer_dataclass_serialization

Function test_writer_dataclass_serialization

tests/test_transcript.py:101–115  ·  view source on GitHub ↗

The writer should accept dataclasses (Message subclasses are dataclasses) via ``asdict``.

(tmp_path: Path)

Source from the content-addressed store, hash-verified

99
100
101def test_writer_dataclass_serialization(tmp_path: Path) -> None:
102 """The writer should accept dataclasses (Message subclasses are
103 dataclasses) via ``asdict``."""
104 from dataclasses import dataclass
105
106 @dataclass
107 class Stub:
108 field: str
109 n: int
110
111 path = tmp_path / "x.jsonl"
112 with TranscriptWriter(path) as w:
113 w.append(Stub(field="hello", n=42))
114 parsed = json.loads(path.read_text().strip())
115 assert parsed == {"field": "hello", "n": 42}
116
117
118def test_writer_unserializable_object_does_not_crash(tmp_path: Path) -> None:

Callers

nothing calls this directly

Calls 3

TranscriptWriterClass · 0.90
StubClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected