plexus.test_prediction_commands module

Comprehensive tests for PredictionCommands.py - the mission-critical scoring system.

This test suite focuses on the most critical aspects of the prediction pipeline: - Score.Input creation and text/metadata preparation - Prediction orchestration and error handling - Parallel processing coordination - Integration with scorecard registry - Cost tracking and resource cleanup

The prediction system is the core of Plexus scoring and handles: 1. Input text and metadata preparation for predictions 2. Async prediction orchestration with proper cleanup 3. Multi-score parallel processing 4. Error propagation and recovery 5. Progress tracking and feedback integration

class plexus.test_prediction_commands.MockScore(name='test_score', costs=None)

Bases: object

Mock score instance for testing

__init__(name='test_score', costs=None)
async async_setup()
get_accumulated_costs()
async predict(input_data)
class plexus.test_prediction_commands.MockScorecard(key='test_scorecard')

Bases: object

Mock scorecard for testing

__init__(key='test_scorecard')
class plexus.test_prediction_commands.TestFeedbackComparison

Bases: object

Test feedback comparison functionality

test_create_feedback_comparison_basic()

Test basic feedback comparison creation

test_create_feedback_comparison_case_insensitive()

Test that feedback comparison is case insensitive

test_create_feedback_comparison_disagreement()

Test feedback comparison when prediction disagrees with ground truth

class plexus.test_prediction_commands.TestPredictScoreImpl

Bases: object

Test the core prediction implementation with proper resource management

async test_predict_score_impl_cost_calculation_error(mock_scorecard)

Test handling when cost calculation fails

async test_predict_score_impl_success(mock_scorecard)

Test successful prediction implementation with proper setup and cleanup

async test_predict_score_impl_with_score_without_costs(mock_scorecard)

Test prediction when score doesn’t have cost tracking

plexus.test_prediction_commands.mock_scorecard()

Mock scorecard for testing

plexus.test_prediction_commands.sample_pandas_row()

Create a sample pandas row with text and metadata

plexus.test_prediction_commands.sample_row_with_complex_metadata()

Create a sample row with complex nested metadata