plexus.test_score module
Comprehensive tests for Score.py - the foundation class of the entire scoring system.
This test suite focuses on the most critical aspects of the Score base class: - Score.Parameters validation and data conversion - Score.Input standardization and edge cases - Score.Result creation, comparison, and helper methods - Score initialization and parameter validation - Registry integration (Score.from_name) - Path generation and utilities - Cost tracking interface
The Score class is the foundation that all other scoring classes inherit from, making these tests critical for the reliability of the entire scoring system.
- class plexus.test_score.ConcreteScore(**parameters)
Bases:
ScoreConcrete implementation of Score for testing since Score is abstract
Initialize the Score instance with the given parameters.
Parameters
- **parametersdict
Arbitrary keyword arguments that are used to initialize the Parameters instance.
Raises
- ValidationError
If the provided parameters do not pass validation.
- class plexus.test_score.TestScoreEdgeCases
Bases:
objectTest edge cases and error conditions
- test_input_with_empty_string_text()
Test Score.Input with empty string text
- test_result_equality_with_invalid_type()
Test Score.Result equality with invalid comparison type
- test_result_with_decimal_confidence()
Test Score.Result with Decimal confidence value
- test_score_parameters_with_none_values()
Test Score.Parameters with None values (should use defaults)
- test_score_with_numeric_string_values()
Test Score handling with numeric string parameters
- class plexus.test_score.TestScoreFromName
Bases:
objectTest Score.from_name registry integration
- test_score_from_name_score_not_found()
Test Score.from_name with nonexistent score in valid scorecard
- test_score_from_name_scorecard_not_found()
Test Score.from_name with nonexistent scorecard
- test_score_from_name_with_complex_parameters()
Test Score.from_name with complex score parameters
- test_successful_score_from_name()
Test successful Score.from_name with valid scorecard and score
- class plexus.test_score.TestScoreInitialization
Bases:
objectTest Score initialization and parameter validation
- test_log_validation_errors_formatting()
Test that validation errors are properly formatted and logged
- test_score_initialization_with_validation_error()
Test Score initialization with parameter validation error
- test_score_with_complex_initialization()
Test Score initialization with complex parameter configuration
- test_successful_score_initialization()
Test successful Score initialization with valid parameters
- class plexus.test_score.TestScoreInput
Bases:
objectTest Score.Input standardization and validation
- test_basic_input_creation()
Test basic Score.Input creation
- test_input_with_complex_metadata()
Test Score.Input with nested, complex metadata
- test_input_with_empty_metadata()
Test Score.Input with empty metadata (default behavior)
- test_input_with_results_for_dependencies()
Test Score.Input with results for dependent scores
- test_input_with_unicode_text()
Test Score.Input with Unicode and special characters
- test_input_with_very_long_text()
Test Score.Input with very long text content
- class plexus.test_score.TestScoreParameters
Bases:
objectTest Score.Parameters validation and data conversion
- test_basic_parameters_creation()
Test basic Score.Parameters creation with valid data
- test_parameters_with_all_optional_fields()
Test parameters with all optional fields populated
- test_parameters_with_data_percentage_conversion()
Test automatic percentage conversion in data field
- test_parameters_with_dependencies()
Test parameters with dependency configuration
- test_parameters_with_numeric_percentage()
Test percentage handling when already numeric
- test_parameters_with_string_percentage_variations()
Test various string percentage formats
- test_parameters_without_percentage_gets_default()
Test that missing percentage gets default value of 100.0
- class plexus.test_score.TestScoreResult
Bases:
objectTest Score.Result creation, comparison, and helper methods
- sample_parameters()
Sample parameters for testing Results
- test_basic_result_creation(sample_parameters)
Test basic Score.Result creation
- test_result_backwards_compatibility_properties(sample_parameters)
Test backwards compatibility properties for explanation and confidence
- test_result_backwards_compatibility_with_empty_metadata(sample_parameters)
Test backwards compatibility when metadata is empty
- test_result_equality_with_other_result(sample_parameters)
Test Score.Result equality comparison with another Result
- test_result_equality_with_string(sample_parameters)
Test Score.Result equality comparison with string
- test_result_is_no_method(sample_parameters)
Test Score.Result.is_no() method
- test_result_is_yes_method(sample_parameters)
Test Score.Result.is_yes() method
- test_result_with_boolean_value(sample_parameters)
Test Score.Result with boolean value
- test_result_with_error(sample_parameters)
Test Score.Result with error information
- test_result_with_metadata(sample_parameters)
Test Score.Result with metadata
- class plexus.test_score.TestScoreUtilityMethods
Bases:
objectTest Score utility methods like path generation and label handling
- test_get_accumulated_costs_default()
Test default cost accumulation (should return zero cost)
- test_get_label_score_name_basic()
Test basic label score name determination
- test_get_label_score_name_with_both_custom_and_field()
Test label score name with both custom label and field
- test_get_label_score_name_with_custom_label()
Test label score name with custom label_score_name
- test_get_label_score_name_with_label_field()
Test label score name with label_field suffix
- test_model_directory_path()
Test model directory path generation
- test_report_directory_path()
Test report directory path generation