-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_import.py
More file actions
82 lines (64 loc) · 2.18 KB
/
test_import.py
File metadata and controls
82 lines (64 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""
Test Import Example
다른 프로젝트에서 beanllm을 import해서 사용하는 예제
"""
def test_import():
"""패키지 import 테스트"""
print("=== Testing beanllm Import ===\n")
# 1. Basic imports
print("1. Testing basic imports...")
try:
from beanllm import get_registry
print(" ✅ get_registry imported")
except ImportError as e:
print(f" ❌ Failed to import get_registry: {e}")
return False
try:
from beanllm import ProviderFactory
print(" ✅ ProviderFactory imported")
except ImportError as e:
print(f" ❌ Failed to import ProviderFactory: {e}")
return False
try:
from beanllm import ModelCapabilityInfo, ProviderInfo
print(" ✅ Data classes imported")
except ImportError as e:
print(f" ❌ Failed to import data classes: {e}")
return False
# 2. Test utils
print("\n2. Testing utils imports...")
try:
from beanllm.utils import EnvConfig
print(" ✅ EnvConfig imported")
print(f" Active providers: {EnvConfig.get_active_providers()}")
except ImportError as e:
print(f" ❌ Failed to import EnvConfig: {e}")
return False
try:
from beanllm.utils import ProviderError, get_logger, retry
print(" ✅ Utils imported (ProviderError, retry, get_logger)")
except ImportError as e:
print(f" ❌ Failed to import utils: {e}")
return False
# 3. Test functionality
print("\n3. Testing functionality...")
try:
registry = get_registry()
models = registry.get_available_models()
print(f" ✅ Registry works: {len(models)} models found")
except Exception as e:
print(f" ❌ Registry failed: {e}")
return False
# 4. Test CLI
print("\n4. Testing CLI...")
try:
from beanllm.cli import main
print(" ✅ CLI main imported")
except ImportError as e:
print(f" ❌ Failed to import CLI: {e}")
return False
print("\n✅ All imports successful!")
return True
if __name__ == "__main__":
success = test_import()
exit(0 if success else 1)