Render the structured sample I/O list as a human-readable string for prompts. Tester (the CustomNode that actually runs them) consumes the list directly via `attrs['sample_io']`, but Agent prompts need a string snippet.
(sample_io: Any)
| 206 | # --------------------------------------------------------------------------- |
| 207 | |
| 208 | def _stringify_sample_io(sample_io: Any) -> str: |
| 209 | """Render the structured sample I/O list as a human-readable string for prompts. |
| 210 | |
| 211 | Tester (the CustomNode that actually runs them) consumes the list directly |
| 212 | via `attrs['sample_io']`, but Agent prompts need a string snippet. |
| 213 | """ |
| 214 | if isinstance(sample_io, str): |
| 215 | return sample_io |
| 216 | if not isinstance(sample_io, list) or not sample_io: |
| 217 | return "(no sample I/O available)" |
| 218 | lines = [] |
| 219 | for case in sample_io: |
| 220 | if not isinstance(case, dict): |
| 221 | continue |
| 222 | call = case.get("call", "") |
| 223 | expected = case.get("expected", "") |
| 224 | if call and expected: |
| 225 | lines.append(f"assert {call} == {expected}") |
| 226 | return "\n".join(lines) if lines else "(no sample I/O available)" |
no test coverage detected