| 67 | |
| 68 | input_type, cfg_type = _introspect_flow_signature(postponed_flow) |
| 69 | |
| 70 | self.assertIs(input_type, ArxivIdentifier) |
| 71 | self.assertIs(cfg_type, PaperSemanticCfg) |
| 72 | |
| 73 | def test_missing_input_param_raises(self) -> None: |
| 74 | async def bad(*, cfg: PaperSemanticCfg | None = None) -> None: |
| 75 | return None |
| 76 | |
| 77 | with self.assertRaises(TypeError): |
| 78 | _introspect_flow_signature(bad) |
| 79 | |
| 80 | def test_missing_cfg_param_raises(self) -> None: |
| 81 | async def bad(input: ArxivIdentifier) -> None: |
| 82 | return None |
| 83 | |
| 84 | with self.assertRaises(TypeError): |
| 85 | _introspect_flow_signature(bad) |
| 86 | |
| 87 | def test_cfg_annotation_must_be_baseflowcfg(self) -> None: |
| 88 | async def bad(input: ArxivIdentifier, *, cfg: int = 0) -> None: |
| 89 | return None |
| 90 | |
| 91 | with self.assertRaises(TypeError): |
| 92 | _introspect_flow_signature(bad) |
| 93 | |
| 94 | |
| 95 | class PydanticSchemaStrTests(unittest.TestCase): |
| 96 | def test_basemodel_renders_json_schema(self) -> None: |
| 97 | # PaperSemanticCfg embeds ModelSettings which has callable fields; |
| 98 | # the renderer falls back to a fields summary in that case. |
| 99 | out = _pydantic_schema_str(PaperSemanticCfg) |
| 100 | parsed = json.loads(out) |
| 101 | self.assertEqual(parsed.get("title"), "PaperSemanticCfg") |
| 102 | self.assertIn("model", parsed["fields"]) |
| 103 | |
| 104 | def test_basemodel_with_clean_schema(self) -> None: |
| 105 | class Clean(BaseModel): |
| 106 | x: int = 0 |
nothing calls this directly
no outgoing calls
no test coverage detected