Files
group_xinghuo_jinrong/tests/test_wave6_analyst_llm.py
T
zhanghongyu_0626 bcd6175d4e feat(analyst): Implement data analysis agent with authentication and query handling
- Introduced `analyst_auth_adapter.py` for managing authentication context and access control for the data analysis agent.
- Added new API endpoints in `analyst.py` for chat, dashboard, asset management, and metrics, utilizing the new authentication context.
- Created Pydantic models in `analyst_schemas.py` for request and response structures, ensuring consistent data handling.
- Updated SQL guard logic in `sql_guard.py` to enforce access restrictions based on user roles and contexts.
- Implemented migration scripts for new database tables related to the data analysis agent, enhancing data management capabilities.
- Removed legacy authentication code from `auth.py`, streamlining the authentication process.

This update significantly enhances the data analysis capabilities, providing a robust framework for querying and managing data securely.
2026-09-09 21:02:11 +08:00

23 lines
580 B
Python

"""llm 客户端测试(extract_sql 纯逻辑 + DeepSeek 真实冒烟)。"""
import unittest
from app.service.llm import extract_sql
class TestExtractSql(unittest.TestCase):
def test_plain(self):
self.assertEqual(extract_sql("SELECT 1"), "SELECT 1")
def test_fenced(self):
self.assertEqual(
extract_sql("结果如下:\n```sql\nSELECT 1\n```"),
"SELECT 1",
)
def test_fenced_no_lang(self):
self.assertEqual(extract_sql("```\nSELECT 2\n```"), "SELECT 2")
if __name__ == "__main__":
unittest.main()