Files
cleveractors-core/features/inline_jinja_handler_direct.feature
CoreRasurae 9753b31c7e
CI / quality (push) Successful in 36s
CI / lint (push) Successful in 38s
CI / typecheck (push) Successful in 49s
CI / security (push) Successful in 51s
CI / integration_tests (push) Successful in 55s
CI / unit_tests (push) Successful in 3m35s
CI / build (push) Successful in 33s
CI / coverage (push) Successful in 3m36s
CI / status-check (push) Successful in 3s
test: add coverage gap tests improving coverage from 81.4% to 96.90%
Add 13 BDD scenarios covering previously uncovered code paths:
- SAFE_BUILTINS validation (sandbox.py: 0% → 100%)
- ConfigurationError re-raise path (config.py: 99.3% → 100%)
- CLI hello/main functions (cli.py: 72.7% → 90.9%)
- GraphState message truncation (state.py: 98.7% → 100%)
- ProgressBarManager update/context rendering (progress.py: 0% → 87.7%)
- MessageRouter regex/exact/contains routing (message_router.py: 0% → 59.4%)
- RoutingAdapter parse_routing_command (routing_adapter.py)
- DynamicRouterNode pattern-based routing (dynamic_router.py)
- EnhancedTemplateRegistry unknown template type (enhanced_registry.py: 99.2%)
- CompositeAgent null-graph error path (composite.py: 97.8% → 98.6%)

Cover routing_adapter.py (17% → 100%): all GOTO/ROUTE patterns,
create_routing_node, create_conditional_router, dynamic config conversion.

Cover dynamic_router.py (21% → 87%): execute with empty/dict/string
messages, extract_message with colon parsing, config creation, graph
extension with edge generation.

Cover message_router.py (59% → 78%): regex, exact, contains, prefix,
suffix match types, invalid regex handling, non-string message, set_state.

Exercise Node._prepare_conversation_history with invalid configs,
_runtime error paths, _execute_message_router with rules,
_execute_agent with current_message and metadata propagation,
_execute_function with dynamic_router, and _execute_conditional
with content_contains/content_not_contains/content_starts_with
and custom condition types. Improves nodes.py from 71.3% to 72.5%.

Exercise PureGraphConfig, PureLangGraph init with dict/config,
RxPyLangGraphBridge registration/connection/lookup,
ReactiveStreamRouter operator creation and condition functions,
ReactiveConfigParser config/route/graph parsing,
ToolAgent tool execution with JSON, space-separated, single,
file_read, progress_bar invocations, and
ReactiveCleverAgentsApp init/dispose/visualization.
2026-06-02 20:02:01 +01:00

82 lines
3.4 KiB
Gherkin

Feature: InlineJinjaHandler Template Processing and Rendering
As a developer
I want the InlineJinjaHandler to extract templates from YAML, apply variables, render deferred content, and parse rendered values
So that inline Jinja2 templates in YAML configurations are processed and rendered correctly
Background:
Given I have a clean test environment
Scenario: Test InlineJinjaHandler initialization
When I create an InlineJinjaHandler instance
Then the Jinja environment should be properly configured
Scenario: Test process_yaml_file with non-template content
Given I have a YAML file with no templates
When I process the file with defer_rendering True
Then it should return normal YAML parsing
Scenario: Test process_yaml_file with templates and deferred rendering
Given I have a YAML file with Jinja templates
When I process the file with defer_rendering True
Then it should extract templates using the handler
Scenario: Test process_yaml_string with templates and immediate rendering
Given I have a YAML string with Jinja templates
And I have template variables
When I process the string with defer_rendering False and context
Then it should render templates and return YAML
Scenario: Test template extraction from complex YAML
Given I have YAML with both inline and block templates
When I extract templates using the handler
Then templates should be replaced with placeholders
And template metadata should be stored
Scenario: Test apply_templates functionality
Given I have a config with template placeholders
And I have template metadata stored
And I have rendering variables
When I apply the templates to the config
Then placeholders should be replaced with rendered values
Scenario: Test _render_template_string method
Given I have a template string
And I have context variables
When I render the template string directly
Then variables should be substituted correctly
Scenario: Test _parse_rendered_value with various types
Given I have various rendered string values to parse
When I parse each value using the handler
Then each should be converted to appropriate Python types
Scenario: Test error handling in process_yaml_file
Given I have an invalid file path
When I try to process the invalid file
Then a FileNotFoundError should be raised appropriately
Scenario: Test edge cases in template extraction
Given I have YAML with edge case template syntax
When I extract templates
Then the handler should process them correctly
Scenario: Test recursive template application
Given I have nested configuration with multiple template levels
When I apply templates recursively
Then all nested placeholders should be resolved
Scenario: Test process_yaml_string with immediate rendering and no context
Given I have a YAML string with simple templates
When I process the string with defer_rendering False and no context
Then it should render with empty context successfully
Scenario: Test apply_templates with config without templates
Given I have a config without template placeholders
When I apply templates to the config
Then it should return the config unchanged
Scenario: Test apply_templates with block templates
Given I have a config with block template placeholders
When I apply templates with block template context
Then block templates should be rendered correctly