-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
49 lines (43 loc) · 1.31 KB
/
__init__.py
File metadata and controls
49 lines (43 loc) · 1.31 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
"""
Test Suite for DSPy Production Examples
This module contains comprehensive tests for:
- Basic DSPy functionality
- Pydantic integration
- Advanced patterns
- Error handling and edge cases
"""
import os
import sys
# Add src directory to Python path for imports
src_path = os.path.join(os.path.dirname(__file__), '..', 'src')
if src_path not in sys.path:
sys.path.insert(0, src_path)
# Test configuration
TEST_CONFIG = {
'skip_if_no_api_key': True,
'max_test_retries': 2,
'test_timeout': 30,
}
# Common test utilities
def skip_if_no_openai_key():
"""Skip test if OpenAI API key is not available."""
import pytest
import os
if not os.getenv('OPENAI_API_KEY'):
pytest.skip("OpenAI API key not available")
def get_test_cases():
"""Get standard test cases for validation."""
return [
{
"question": "What is machine learning?",
"expected_topics": ["algorithms", "data", "learning", "artificial", "intelligence"]
},
{
"question": "How does photosynthesis work?",
"expected_topics": ["plants", "sunlight", "energy", "carbon", "oxygen"]
},
{
"question": "What is Python programming?",
"expected_topics": ["programming", "language", "code", "software", "development"]
}
]