milwright commited on
Commit
78502a9
·
1 Parent(s): 9ad9eac

remove unnecessary config.json and test_app.py files

Browse files
Files changed (2) hide show
  1. config.json +0 -5
  2. test_app.py +0 -191
config.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "assistant_name": "Test Assistant",
3
- "system_prompt": "Test prompt",
4
- "model_id": "gemini/gemini-1.5-flash-latest"
5
- }
 
 
 
 
 
 
test_app.py DELETED
@@ -1,191 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Test script for ChatUI Helper application"""
3
-
4
- import sys
5
- import json
6
- from pathlib import Path
7
-
8
- def test_imports():
9
- """Test all module imports"""
10
- try:
11
- from app import SpaceGenerator
12
- print("✅ app.py imports successfully")
13
-
14
- from utils import ConfigurationManager, AVAILABLE_THEMES, fetch_url_content
15
- print("✅ utils.py imports successfully")
16
-
17
- from space_template import get_template, validate_template
18
- print("✅ space_template.py imports successfully")
19
-
20
- from support_docs import create_support_docs
21
- print("✅ support_docs.py imports successfully")
22
-
23
- return True
24
- except Exception as e:
25
- print(f"❌ Import error: {e}")
26
- return False
27
-
28
- def test_configuration():
29
- """Test configuration management"""
30
- try:
31
- from utils import ConfigurationManager
32
-
33
- test_config = {
34
- "assistant_name": "Test Assistant",
35
- "system_prompt": "Test prompt",
36
- "model_id": "gemini/gemini-1.5-flash-latest"
37
- }
38
-
39
- cm = ConfigurationManager(test_config)
40
- print("✅ ConfigurationManager initialized")
41
-
42
- # Test save and load
43
- cm.save_config(test_config)
44
- loaded = cm.load_config()
45
- print("✅ Config save/load works")
46
-
47
- return True
48
- except Exception as e:
49
- print(f"❌ Configuration error: {e}")
50
- return False
51
-
52
- def test_templates():
53
- """Test academic templates"""
54
- try:
55
- with open('academic_templates.json', 'r') as f:
56
- templates = json.load(f)
57
-
58
- print(f"✅ Loaded {len(templates)} academic templates")
59
-
60
- for name, template in templates.items():
61
- required_fields = ['assistant_name', 'tagline', 'system_prompt', 'example_prompts']
62
- for field in required_fields:
63
- if field not in template:
64
- print(f"❌ Template '{name}' missing field: {field}")
65
- return False
66
-
67
- print("✅ All templates have required fields")
68
- return True
69
- except Exception as e:
70
- print(f"❌ Template error: {e}")
71
- return False
72
-
73
- def test_space_template():
74
- """Test space template generation"""
75
- try:
76
- from space_template import get_template, validate_template
77
-
78
- validate_template()
79
- print("✅ Template validation passed")
80
-
81
- template = get_template()
82
- print(f"✅ Template size: {len(template)} characters")
83
-
84
- # Check for critical placeholders
85
- placeholders = [
86
- '{assistant_name}',
87
- '{system_prompt}',
88
- '{model_id}',
89
- '{temperature}',
90
- '{max_tokens}'
91
- ]
92
-
93
- for placeholder in placeholders:
94
- if placeholder not in template:
95
- print(f"❌ Missing placeholder: {placeholder}")
96
- return False
97
-
98
- print("✅ All critical placeholders present")
99
- return True
100
- except Exception as e:
101
- print(f"❌ Space template error: {e}")
102
- return False
103
-
104
- def test_themes():
105
- """Test theme availability"""
106
- try:
107
- from utils import AVAILABLE_THEMES
108
-
109
- print(f"✅ {len(AVAILABLE_THEMES)} themes available")
110
-
111
- for name, theme_class in AVAILABLE_THEMES.items():
112
- print(f" - {name}")
113
-
114
- return True
115
- except Exception as e:
116
- print(f"❌ Theme error: {e}")
117
- return False
118
-
119
- def test_docs():
120
- """Test documentation files"""
121
- try:
122
- # Check docs.md exists and has content
123
- docs_path = Path('docs.md')
124
- if not docs_path.exists():
125
- print("❌ docs.md not found")
126
- return False
127
-
128
- content = docs_path.read_text()
129
- print(f"✅ docs.md exists ({len(content)} characters)")
130
-
131
- # Check for images
132
- import re
133
- img_pattern = r'<img[^>]+src="([^"]+)"'
134
- images = re.findall(img_pattern, content)
135
- print(f"✅ Found {len(images)} image references in docs.md")
136
-
137
- # Check image files exist
138
- img_dir = Path('img')
139
- if img_dir.exists():
140
- img_files = list(img_dir.glob('*.png'))
141
- print(f"✅ Found {len(img_files)} image files")
142
-
143
- return True
144
- except Exception as e:
145
- print(f"❌ Documentation error: {e}")
146
- return False
147
-
148
- def main():
149
- """Run all tests"""
150
- print("=" * 50)
151
- print("ChatUI Helper Test Suite")
152
- print("=" * 50)
153
-
154
- tests = [
155
- ("Imports", test_imports),
156
- ("Configuration", test_configuration),
157
- ("Templates", test_templates),
158
- ("Space Template", test_space_template),
159
- ("Themes", test_themes),
160
- ("Documentation", test_docs)
161
- ]
162
-
163
- results = []
164
- for name, test_func in tests:
165
- print(f"\n Testing {name}...")
166
- success = test_func()
167
- results.append((name, success))
168
- print()
169
-
170
- print("=" * 50)
171
- print("Test Results Summary")
172
- print("=" * 50)
173
-
174
- for name, success in results:
175
- status = "✅ PASS" if success else "❌ FAIL"
176
- print(f"{name:20} {status}")
177
-
178
- total = len(results)
179
- passed = sum(1 for _, s in results if s)
180
-
181
- print(f"\nTotal: {passed}/{total} tests passed")
182
-
183
- if passed == total:
184
- print("\n🎉 All tests passed!")
185
- return 0
186
- else:
187
- print(f"\n⚠️ {total - passed} test(s) failed")
188
- return 1
189
-
190
- if __name__ == "__main__":
191
- sys.exit(main())