mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-27 04:20:09 +00:00
- Update quality-gate.yml to only lint hanzo_mcp and tests directories
- Add ruff config to pyproject.toml:
- Exclude vscode-extension and node_modules
- Ignore lint rules that conflict with test patterns:
B023 (loop variable binding), B904 (raise from),
E741 (ambiguous vars), F401/F821/F841 (unused/undefined in tests)
- Apply per-file ignores for tests/ and __init__.py
- Apply ruff fixes for import sorting and format
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
"""Test helper classes for MCP tools testing."""
|
|
|
|
from typing import Any, Dict
|
|
|
|
|
|
class PaginatedResponseWrapper:
|
|
"""Wrapper class for paginated responses to support tests."""
|
|
|
|
def __init__(self, items=None, next_cursor=None, has_more=False, total_items=None):
|
|
"""Initialize paginated response."""
|
|
self.items = items or []
|
|
self.next_cursor = next_cursor
|
|
self.has_more = has_more
|
|
self.total_items = total_items or len(self.items)
|
|
|
|
def to_json(self) -> Dict[str, Any]:
|
|
"""Convert to JSON-serializable dict."""
|
|
return {
|
|
"items": self.items,
|
|
"_meta": {
|
|
"next_cursor": self.next_cursor,
|
|
"has_more": self.has_more,
|
|
"total_items": self.total_items,
|
|
},
|
|
}
|
|
|
|
|
|
# Export a convenience constructor
|
|
def PaginatedResponse(items=None, next_cursor=None, has_more=False, total_items=None):
|
|
"""Create a paginated response for testing."""
|
|
return PaginatedResponseWrapper(items, next_cursor, has_more, total_items)
|