mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 00:23:17 +00:00
fix: ruff
This commit is contained in:
@@ -11,7 +11,6 @@ from application.api.answer.services.compression.prompt_builder import (
|
||||
from application.api.answer.services.compression.token_counter import TokenCounter
|
||||
from application.api.answer.services.compression.types import (
|
||||
CompressionMetadata,
|
||||
CompressionResult,
|
||||
)
|
||||
from application.core.settings import settings
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
from unittest.mock import Mock, MagicMock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from application.agents.base import BaseAgent
|
||||
from application.llm.handlers.base import LLMHandler, ToolCall
|
||||
@@ -310,7 +310,7 @@ class TestLLMHandlerTokenTracking:
|
||||
tools_dict = {}
|
||||
|
||||
# Execute streaming
|
||||
results = list(handler.handle_streaming(mock_agent, "first", tools_dict, messages))
|
||||
list(handler.handle_streaming(mock_agent, "first", tools_dict, messages))
|
||||
|
||||
# Should have called gen_stream with tools=None (disabled)
|
||||
mock_agent.llm.gen_stream.assert_called()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
from datetime import datetime, timezone
|
||||
from unittest.mock import Mock, MagicMock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from application.api.answer.services.compression import CompressionService
|
||||
from application.api.answer.services.compression.threshold_checker import (
|
||||
@@ -258,7 +258,7 @@ class TestCompressionService:
|
||||
mock_summary = "<summary>Test summary with tools</summary>"
|
||||
compression_service.llm.gen.return_value = mock_summary
|
||||
|
||||
result = compression_service.compress_conversation(
|
||||
compression_service.compress_conversation(
|
||||
conversation=conversation, compress_up_to_index=0
|
||||
)
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ DocsGPT provides:
|
||||
try:
|
||||
error_data = response.json()
|
||||
self.print_error(f"Error: {error_data}")
|
||||
except:
|
||||
except Exception:
|
||||
self.print_error(f"Response: {response.text[:500]}")
|
||||
self.test_results.append((test_name, False, f"Status {response.status_code}"))
|
||||
return None
|
||||
@@ -371,7 +371,7 @@ DocsGPT provides:
|
||||
|
||||
try:
|
||||
self.print_info(f"POST {endpoint}")
|
||||
self.print_info(f"Crawling: https://docs.docsgpt.cloud/")
|
||||
self.print_info("Crawling: https://docs.docsgpt.cloud/")
|
||||
|
||||
response = requests.post(
|
||||
endpoint,
|
||||
@@ -401,7 +401,7 @@ DocsGPT provides:
|
||||
try:
|
||||
error_data = response.json()
|
||||
self.print_error(f"Error: {error_data}")
|
||||
except:
|
||||
except Exception:
|
||||
self.print_error(f"Response: {response.text[:500]}")
|
||||
self.test_results.append((test_name, False, f"Status {response.status_code}"))
|
||||
return None
|
||||
@@ -556,7 +556,7 @@ DocsGPT provides:
|
||||
try:
|
||||
error_data = response.json()
|
||||
self.print_error(f"Error: {error_data.get('message', response.text[:200])}")
|
||||
except:
|
||||
except Exception:
|
||||
self.print_error(f"Response: {response.text[:500]}")
|
||||
self.test_results.append((test_name, False, f"Status {response.status_code}"))
|
||||
return None
|
||||
@@ -803,7 +803,7 @@ DocsGPT provides:
|
||||
try:
|
||||
error_data = response.json()
|
||||
self.print_error(f"Error: {error_data.get('message', response.text[:200])}")
|
||||
except:
|
||||
except Exception:
|
||||
self.print_error(f"Response: {response.text[:500]}")
|
||||
self.test_results.append((test_name, False, f"Status {response.status_code}"))
|
||||
return None
|
||||
@@ -997,7 +997,7 @@ DocsGPT provides:
|
||||
conversation_id = result.get('conversation_id', conversation_id)
|
||||
self.print_success("Critical information sent")
|
||||
else:
|
||||
self.print_error(f"Critical info request failed")
|
||||
self.print_error("Critical info request failed")
|
||||
self.test_results.append((test_name, False, "Critical info failed"))
|
||||
return False
|
||||
time.sleep(2)
|
||||
@@ -1027,7 +1027,7 @@ DocsGPT provides:
|
||||
conversation_id = result.get('conversation_id', conversation_id)
|
||||
self.print_success(f"Burying question {i+1}/2 completed")
|
||||
else:
|
||||
self.print_error(f"Request failed")
|
||||
self.print_error("Request failed")
|
||||
self.test_results.append((test_name, False, "Burying questions failed"))
|
||||
return False
|
||||
time.sleep(2)
|
||||
@@ -1064,7 +1064,7 @@ DocsGPT provides:
|
||||
self.test_results.append((test_name, False, "Info not preserved"))
|
||||
return False
|
||||
else:
|
||||
self.print_error(f"Recall request failed")
|
||||
self.print_error("Recall request failed")
|
||||
self.test_results.append((test_name, False, "Recall failed"))
|
||||
return False
|
||||
except Exception as e:
|
||||
|
||||
@@ -64,7 +64,7 @@ def test_model_without_base_url():
|
||||
def test_validate_model_id():
|
||||
"""Test model_id validation"""
|
||||
# Get the registry instance to check what models are available
|
||||
registry = ModelRegistry.get_instance()
|
||||
ModelRegistry.get_instance()
|
||||
|
||||
# Test with a model that should exist (docsgpt-local is always added)
|
||||
assert validate_model_id("docsgpt-local") is True
|
||||
|
||||
@@ -6,6 +6,7 @@ They are skipped until the following modules are created:
|
||||
- application.compression (DocumentCompressor, HistoryCompressor, etc.)
|
||||
- application.core.token_budget (TokenBudgetManager)
|
||||
"""
|
||||
# ruff: noqa: F821
|
||||
import pytest
|
||||
|
||||
pytest.skip(
|
||||
|
||||
Reference in New Issue
Block a user