import pytest from models import ChatCompletionRequest, Message def test_chat_completion_request_parsing(): req = ChatCompletionRequest( model="needle3", messages=[ Message(role="user", content="hello") ], tools=[{"name": "test", "description": "desc", "parameters": {"type": "object"}}] ) assert req.model == "needle3" assert len(req.messages) == 1 assert req.messages[0].content == "hello" assert len(req.tools) == 1 def test_mcp_input_schema_and_openai_strict_shapes(): from registry import normalize_tool schema={'type':'object','properties':{'path':{'type':'string'}},'required':['path']} mcp={'name':'read_file','description':'Read file','inputSchema':schema,'annotations':{'readOnlyHint':True}} openai={'type':'function','function':{'name':'read_file','description':'Read file','parameters':schema,'strict':True}} assert normalize_tool(mcp)==normalize_tool(openai) def test_conflicting_mcp_and_native_schemas_are_rejected(): import pytest from registry import normalize_tool with pytest.raises(ValueError,match='conflicting'): normalize_tool({'name':'read','description':'Read','parameters':{'type':'object'},'inputSchema':{'type':'string'}})