Documentation for test_resolution_from_low_confidence.py
Test File
- Source:
test/src/ontobdc/run/plugin/capability/test_resolution_from_low_confidence.py - Unit under test:
ResolutionFromLowConfidenceCapability - Style:
unittestwithpatch
What This File Tests
This document describes the step executed when the intent still has low confidence and the system attempts to find compatible capabilities from the canonical intent and the parse returned by the resolver.
Documented Scenario
test_execute_finds_matching_capabilities
What is tested
- The capability runs its main flow with
context_language,user_intent, andcanonical_intentdefined. - The NLP resolver returns an
IntentScoreResponsewith score0.8and a valid nominal root. - The capability loader returns a dummy candidate capability.
- The execution attempts to persist the canonical intent result in the configuration directory.
Expected result
result["cli_context"].get_parameter_value("intent_score")returns0.8.- The file
IntentScoreResponse.CANONICALIZED_INTENT_FILE_NAMEexists in the temporary directory. - The flow completes without raising an exception.
What is mocked
SpacyIntentModelResolver, to controlparse_intent().CapabilityLoader, to control the available capabilities.get_config_dir, to isolate file output in a temporary directory.spacyandspacy.tokens, injected intosys.modulesbefore import.
What is not mocked
ResolutionFromLowConfidenceCapability, executed for real.CliContextAdapter, used for real.IntentScoreResponse, instantiated for real.- File output inside
tempfile.TemporaryDirectory(). DummyQueryCapability, used as a simple concrete implementation.
Notes
- The test covers the happy path.
- The assertion verifies the score and file existence, but does not validate the saved file contents.