Spaces:
Running
Running
File size: 2,446 Bytes
c262d1a |
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 |
#!/usr/bin/env python3
"""
Test script for GAIAQuestionLoader
"""
from gaia_loader import GAIAQuestionLoader
def test_gaia_loader():
"""Test the GAIA question loader functionality"""
print("π§ͺ Testing GAIAQuestionLoader")
print("=" * 50)
# Initialize loader
loader = GAIAQuestionLoader()
# Test basic functionality
print("\nπ Loader Summary:")
summary = loader.summary()
for key, value in summary.items():
print(f" {key}: {value}")
# Test random question
print("\nπ² Random Question:")
random_q = loader.get_random_question()
if random_q:
print(f" Task ID: {random_q['task_id']}")
print(f" Question: {random_q['question'][:100]}...")
print(f" Has file: {'Yes' if random_q.get('file_name') else 'No'}")
print(f" Level: {random_q.get('Level', 'Unknown')}")
# Test questions with files
print("\nπ Questions with Files:")
with_files = loader.get_questions_with_files()
print(f" Found {len(with_files)} questions with files")
for q in with_files[:3]: # Show first 3
print(f" - {q['task_id']}: {q.get('file_name', 'N/A')}")
# Test questions without files
print("\nπ Questions without Files:")
without_files = loader.get_questions_without_files()
print(f" Found {len(without_files)} questions without files")
for q in without_files[:3]: # Show first 3
print(f" - {q['task_id']}: {q['question'][:50]}...")
# Test by level
print("\nπ Questions by Level:")
by_level = loader.count_by_level()
for level, count in by_level.items():
print(f" Level {level}: {count} questions")
# Show one example from each level
level_questions = loader.get_questions_by_level(level)
if level_questions:
example = level_questions[0]
print(f" Example: {example['question'][:60]}...")
# Test specific question lookup
print("\nπ Test Question Lookup:")
if loader.questions:
test_id = loader.questions[0]['task_id']
found_q = loader.get_question_by_id(test_id)
if found_q:
print(f" β
Successfully found question by ID: {test_id}")
else:
print(f" β Failed to find question by ID: {test_id}")
print("\nβ
GAIAQuestionLoader test completed!")
if __name__ == "__main__":
test_gaia_loader() |