Skip to content

Commit 48cd2ab

Browse files
committed
Translate Chinese comments to English in test files
1 parent 5d67c56 commit 48cd2ab

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

tests/test_knowledgebase.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222

2323

2424
class TestKnowledgeBase:
25-
"""测试KnowledgeBase类"""
25+
"""Test KnowledgeBase class"""
2626

2727
@pytest.mark.asyncio
2828
async def test_knowledgebase_creation(self):
29-
"""测试KnowledgeBase基本创建"""
30-
# Mock get_ark_token函数来避免实际的认证调用
29+
"""Test basic KnowledgeBase creation"""
30+
# Mock get_ark_token function to avoid actual authentication calls
3131
with patch("veadk.auth.veauth.ark_veauth.get_ark_token") as mock_get_ark_token:
3232
mock_get_ark_token.return_value = "mocked_token"
3333

@@ -41,14 +41,14 @@ async def test_knowledgebase_creation(self):
4141

4242
@pytest.mark.asyncio
4343
async def test_knowledgebase_with_custom_backend(self):
44-
"""测试KnowledgeBase使用自定义backend实例"""
45-
# Mock get_ark_token函数来避免实际的认证调用
44+
"""Test KnowledgeBase with custom backend instance"""
45+
# Mock get_ark_token function to avoid actual authentication calls
4646
with patch("veadk.auth.veauth.ark_veauth.get_ark_token") as mock_get_ark_token:
4747
mock_get_ark_token.return_value = "mocked_token"
4848

4949
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
5050

51-
# 创建实际的backend实例而不是Mock对象
51+
# Create actual backend instance instead of Mock object
5252
from veadk.knowledgebase.backends.in_memory_backend import (
5353
InMemoryKnowledgeBackend,
5454
)
@@ -60,18 +60,18 @@ async def test_knowledgebase_with_custom_backend(self):
6060

6161
assert kb._backend == custom_backend
6262
assert kb.app_name == app_name
63-
assert kb.index == "test_index" # index应该来自backend
63+
assert kb.index == "test_index" # index should come from backend
6464

6565
@pytest.mark.asyncio
6666
async def test_knowledgebase_with_invalid_backend(self):
67-
"""测试KnowledgeBase使用无效backend类型"""
68-
# Mock get_ark_token函数来避免实际的认证调用
67+
"""Test KnowledgeBase with invalid backend type"""
68+
# Mock get_ark_token function to avoid actual authentication calls
6969
with patch("veadk.auth.veauth.ark_veauth.get_ark_token") as mock_get_ark_token:
7070
mock_get_ark_token.return_value = "mocked_token"
7171

7272
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
7373

74-
# 测试无效backend类型
74+
# Test invalid backend type
7575
with pytest.raises(ValueError):
7676
KnowledgeBase(backend="invalid_backend", app_name="test_app")
7777

tests/test_long_term_memory.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030

3131

3232
class TestLongTermMemory:
33-
"""测试LongTermMemory类"""
33+
"""Test LongTermMemory class"""
3434

3535
@pytest.mark.asyncio
3636
async def test_long_term_memory_creation(self):
37-
"""测试LongTermMemory基本创建"""
37+
"""Test basic LongTermMemory creation"""
3838
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
3939
long_term_memory = LongTermMemory(backend="local")
4040

@@ -56,10 +56,10 @@ async def test_long_term_memory_creation(self):
5656

5757
@pytest.mark.asyncio
5858
async def test_long_term_memory_with_custom_backend(self):
59-
"""测试LongTermMemory使用自定义backend实例"""
59+
"""Test LongTermMemory with custom backend instance"""
6060
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
6161

62-
# 创建模拟backend实例
62+
# Create mock backend instance
6363
mock_backend = Mock(spec=BaseLongTermMemoryBackend)
6464
mock_backend.index = "test_index"
6565

@@ -69,21 +69,21 @@ async def test_long_term_memory_with_custom_backend(self):
6969

7070
@pytest.mark.asyncio
7171
async def test_long_term_memory_with_invalid_backend(self):
72-
"""测试LongTermMemory使用无效backend类型"""
72+
"""Test LongTermMemory with invalid backend type"""
7373
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
7474

75-
# 测试无效backend类型
75+
# Test invalid backend type
7676
with pytest.raises(ValueError):
7777
LongTermMemory(backend="invalid_backend")
7878

7979
@pytest.mark.asyncio
8080
async def test_long_term_memory_properties(self):
81-
"""测试LongTermMemory属性"""
81+
"""Test LongTermMemory properties"""
8282
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
8383

8484
long_term_memory = LongTermMemory(backend="local")
8585

86-
# 测试基本属性
86+
# Test basic properties
8787
assert hasattr(long_term_memory, "backend")
8888

8989
@pytest.mark.asyncio
@@ -93,10 +93,10 @@ async def test_long_term_memory_properties(self):
9393
async def test_long_term_memory_without_embedding_api_key(
9494
self, mock_get_credential, mock_get_ark_token
9595
):
96-
"""测试在没有embedding api key时初始化LongTermMemory"""
97-
# Mock get_ark_token函数来抛出ValueError异常,模拟无法获取ARK token的情况
96+
"""Test LongTermMemory initialization without embedding API key"""
97+
# Mock get_ark_token function to throw ValueError exception, simulating inability to get ARK token
9898
mock_get_ark_token.side_effect = ValueError("Failed to get ARK api key")
99-
# Mock get_credential_from_vefaas_iam函数来抛出FileNotFoundError异常,模拟无法从IAM文件获取凭证的情况
99+
# Mock get_credential_from_vefaas_iam function to throw FileNotFoundError exception, simulating inability to get credentials from IAM file
100100
mock_get_credential.side_effect = FileNotFoundError(
101101
"Mocked VeFaaS IAM file not found"
102102
)
@@ -110,31 +110,31 @@ async def test_long_term_memory_without_embedding_api_key(
110110

111111
@pytest.mark.asyncio
112112
async def test_long_term_memory_backend_initialization(self):
113-
"""测试LongTermMemory backend初始化过程"""
113+
"""Test LongTermMemory backend initialization process"""
114114
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
115115

116116
long_term_memory = LongTermMemory(backend="local")
117117

118-
# 验证backend已正确初始化
118+
# Verify backend is correctly initialized
119119
assert long_term_memory._backend is not None
120120
assert isinstance(long_term_memory._backend, InMemoryLongTermMemoryBackend)
121121

122122
@pytest.mark.asyncio
123123
async def test_long_term_memory_string_representation(self):
124-
"""测试LongTermMemory的字符串表示"""
124+
"""Test LongTermMemory string representation"""
125125
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
126126

127127
long_term_memory = LongTermMemory(backend="local")
128128

129-
# 测试字符串表示
129+
# Test string representation
130130
str_repr = str(long_term_memory)
131-
# 检查是否包含关键信息
131+
# Check if contains key information
132132
assert "backend" in str_repr
133133
assert "local" in str_repr
134134

135135
@pytest.mark.asyncio
136136
async def test_long_term_memory_with_app_name(self):
137-
"""测试LongTermMemory使用app_name参数"""
137+
"""Test LongTermMemory with app_name parameter"""
138138
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
139139

140140
app_name = "test_app"
@@ -146,12 +146,12 @@ async def test_long_term_memory_with_app_name(self):
146146

147147
@pytest.mark.asyncio
148148
async def test_long_term_memory_tool_integration(self):
149-
"""测试LongTermMemory与Agent工具的集成"""
149+
"""Test LongTermMemory integration with Agent tools"""
150150
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
151151

152152
long_term_memory = LongTermMemory(backend="local")
153153

154-
# 创建多个Agent实例测试工具集成
154+
# Create multiple Agent instances to test tool integration
155155
agents = []
156156
for i in range(3):
157157
agent = Agent(
@@ -166,18 +166,18 @@ async def test_long_term_memory_tool_integration(self):
166166
)
167167
agents.append(agent)
168168

169-
# 验证每个Agent都有正确的工具集成
169+
# Verify each Agent has correct tool integration
170170
for agent in agents:
171171
assert load_memory in agent.tools
172172
assert agent.long_term_memory == long_term_memory
173173

174174
@pytest.mark.asyncio
175175
async def test_long_term_memory_backend_types(self):
176-
"""测试LongTermMemory支持的不同backend类型"""
176+
"""Test different backend types supported by LongTermMemory"""
177177
os.environ["MODEL_EMBEDDING_API_KEY"] = "mocked_api_key"
178178

179-
# 测试支持的backend类型
180-
supported_backends = ["local"] # 目前只支持local
179+
# Test supported backend types
180+
supported_backends = ["local"] # Currently only supports local
181181

182182
for backend_type in supported_backends:
183183
long_term_memory = LongTermMemory(backend=backend_type)

0 commit comments

Comments
 (0)