Test script for Judge Persona Loader (H.3.1.8).
Comprehensive tests for:
- Persona loading - single and batch
- Schema validation - required fields and constraints
- Prompt template rendering - with context injection
- Weight normalization - across personas
- Model routing - configuration priority
- Diversity verification - model family requirements
- Verdict mapping - persona-specific to unified
- Environment variable overrides
File: test_persona_loader.py
Classes
TestPersonaLoading
Tests for persona loading functionality.
TestSchemaValidation
Tests for persona schema validation.
TestPromptTemplateGeneration
Tests for prompt template generation.
TestModelRouting
Tests for model routing functionality.
TestDiversityVerification
Tests for panel diversity verification.
TestWeightNormalization
Tests for persona weight normalization.
TestVerdictMapping
Tests for verdict mapping functionality.
TestTriggerConditions
Tests for trigger condition matching.
TestConvenienceFunctions
Tests for module-level convenience functions.
TestConfigurationAccess
Tests for configuration access.
Functions
run_tests()
Run all tests.
setUpClass(cls)
Set up test fixtures.
test_loader_initialization()
Test that PersonaLoader initializes successfully.
test_get_all_personas()
Test loading all personas.
test_get_all_personas_enabled_only()
Test that enabled_only filter works.
test_get_persona_by_id()
Test loading a specific persona by ID.
test_get_persona_not_found()
Test that PersonaNotFoundError is raised for unknown persona.
test_all_expected_personas_exist()
Test that all 5 core personas exist.
test_persona_demographics()
Test that persona demographics are properly loaded.
setUpClass(cls)
No description
test_validate_valid_persona()
Test that valid personas pass validation.
test_validate_all_personas()
Test validation of all loaded personas.
test_validate_required_fields()
Test that validation catches missing required fields.
test_validate_weight_range()
Test that weight validation works.
setUpClass(cls)
No description
Usage
python test_persona_loader.py