mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-13 22:15:10 +00:00
chore(deps): redis 8, tiktoken 0.14, openapi3-parser 2, daytona 0.211, reportlab 5
Major bumps whose ceilings had to move. redis 8.1.0, tiktoken 0.14.0 and daytona 0.211.2 needed no code change (the Daytona client, filesystem and process signatures the sandbox calls are unchanged; redis 8 was checked against a live server through the app's own sync and async clients). reportlab 5.0.1 is test-only. openapi-parser 2.0.0 is a rewrite onto pydantic spec models: `paths` is now a dict keyed by URL rather than a list of objects carrying their own `url`, and a path item exposes one field per HTTP method instead of an `operations` list. `OpenAPI3Parser` reads both accordingly, iterating methods in the order the spec declares them, and its rendered output is byte-identical to before. The rewrite also drops prance, openapi-spec-validator and five more transitive packages. tokenizers stays at 0.22.2: transformers 5.8.1 caps it at <=0.23.0 and no such release exists, so it moves with the transformers cap or not at all.
This commit is contained in:
1 parent
7e00197678
commit
b3326b3c33
8 files changed
+197
-369
No files matched your search
@@ -3,6 +3,19 @@
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
_HTTP_METHODS = ("get", "put", "post", "delete", "options", "head", "patch", "trace")
|
||||
|
||||
|
||||
def _path_item(description=None, parameters=None, **operations):
|
||||
"""A stand-in for openapi-parser 2.x's PathItem: one field per HTTP method,
|
||||
``None`` where the spec defines no operation."""
|
||||
item = MagicMock()
|
||||
item.description = description
|
||||
item.parameters = parameters
|
||||
for method in _HTTP_METHODS:
|
||||
setattr(item, method, operations.get(method))
|
||||
return item
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestOpenAPI3ParserImportFallback:
|
||||
@@ -31,14 +44,12 @@ class TestOpenAPI3ParserImportFallback:
|
||||
assert len(urls) == 2
|
||||
|
||||
def test_get_info_from_paths_empty(self):
|
||||
"""Cover path with no operations."""
|
||||
"""Cover a path item that defines no methods."""
|
||||
with patch("docsgpt.parser.file.openapi3_parser.parse"):
|
||||
from docsgpt.parser.file.openapi3_parser import OpenAPI3Parser
|
||||
|
||||
parser = OpenAPI3Parser()
|
||||
mock_path = MagicMock()
|
||||
mock_path.operations = []
|
||||
result = parser.get_info_from_paths(mock_path)
|
||||
result = parser.get_info_from_paths(_path_item())
|
||||
assert result == ""
|
||||
|
||||
def test_parse_file_writes_results(self, tmp_path):
|
||||
@@ -49,15 +60,9 @@ class TestOpenAPI3ParserImportFallback:
|
||||
mock_server = MagicMock()
|
||||
mock_server.url = "https://api.example.com"
|
||||
|
||||
mock_path = MagicMock()
|
||||
mock_path.url = "/users"
|
||||
mock_path.description = "Get users"
|
||||
mock_path.parameters = []
|
||||
mock_path.operations = []
|
||||
|
||||
mock_data = MagicMock()
|
||||
mock_data.servers = [mock_server]
|
||||
mock_data.paths = [mock_path]
|
||||
mock_data.paths = {"/users": _path_item(description="Get users")}
|
||||
mock_parse.return_value = mock_data
|
||||
|
||||
parser = OpenAPI3Parser()
|
||||
|
||||
Reference in new issue
Block a user