Files
cleveragents-core/features/streamedchange_coverage.feature
T

183 lines
9.0 KiB
Gherkin

Feature: Streamed Change Models Coverage
As a developer
I want to test the streamed change models
So that change tracking is properly validated and coverage is improved
Scenario: Create StreamedChangeSection with valid line numbers
Given I import the StreamedChangeSection class
When I create a StreamedChangeSection with start_line 10
And I set end_line to 20
And I set start_line_string to "def function():"
And I set end_line_string to "return result"
Then the StreamedChangeSection instance should be created successfully
And the start_line should be 10
And the end_line should be 20
And the start_line_string should be "def function():"
And the end_line_string should be "return result"
Scenario: Create StreamedChangeSection with single line change
Given I import the StreamedChangeSection class
When I create a StreamedChangeSection with start_line 1
And I set end_line to 1
And I set start_line_string to "import os"
And I set end_line_string to "import os"
Then the StreamedChangeSection instance should be created successfully
And the start_line should be 1
And the end_line should be 1
And the start_line_string should be "import os"
And the end_line_string should be "import os"
Scenario: Create StreamedChangeSection with large line numbers
Given I import the StreamedChangeSection class
When I create a StreamedChangeSection with start_line 1000
And I set end_line to 2000
And I set start_line_string to "class LargeClass:"
And I set end_line_string to "# End of class"
Then the StreamedChangeSection instance should be created successfully
And the start_line should be 1000
And the end_line should be 2000
Scenario: Create StreamedChangeSection using field aliases
Given I import the StreamedChangeSection class
When I create a StreamedChangeSection using aliases
Then the StreamedChangeSection should accept the aliased fields
And the section values should be properly mapped
Scenario: Validate StreamedChangeSection configuration
Given I import the StreamedChangeSection class
When I create a StreamedChangeSection with valid data
Then the section configuration should have str_strip_whitespace as true
And the section configuration should have validate_assignment as true
And the section configuration should have arbitrary_types_allowed as false
And the section configuration should have populate_by_name as true
And the section configuration should have use_enum_values as true
Scenario: Create StreamedChangeWithLineNums with included boundaries
Given I import the StreamedChangeWithLineNums class
And I have a valid StreamedChangeSection for old section
When I create a StreamedChangeWithLineNums with the old section
And I set start_line_included to true
And I set end_line_included to true
And I set new content to "Updated code block"
Then the StreamedChangeWithLineNums instance should be created successfully
And the old section should match the provided section
And the start_line_included should be true
And the end_line_included should be true
And the new content should be "Updated code block"
Scenario: Create StreamedChangeWithLineNums with excluded boundaries
Given I import the StreamedChangeWithLineNums class
And I have a valid StreamedChangeSection for old section
When I create a StreamedChangeWithLineNums with the old section
And I set start_line_included to false
And I set end_line_included to false
And I set new content to "Replacement text"
Then the StreamedChangeWithLineNums instance should be created successfully
And the start_line_included should be false
And the end_line_included should be false
And the new content should be "Replacement text"
Scenario: Create StreamedChangeWithLineNums with mixed boundaries
Given I import the StreamedChangeWithLineNums class
And I have a valid StreamedChangeSection for old section
When I create a StreamedChangeWithLineNums with the old section
And I set start_line_included to true
And I set end_line_included to false
And I set new content to "Partial replacement"
Then the StreamedChangeWithLineNums instance should be created successfully
And the start_line_included should be true
And the end_line_included should be false
Scenario: Create StreamedChangeWithLineNums with empty new content
Given I import the StreamedChangeWithLineNums class
And I have a valid StreamedChangeSection for old section
When I create a StreamedChangeWithLineNums with the old section
And I set start_line_included to true
And I set end_line_included to true
And I set new content to ""
Then the StreamedChangeWithLineNums instance should be created successfully
And the new content should be ""
Scenario: Create StreamedChangeWithLineNums with multiline new content
Given I import the StreamedChangeWithLineNums class
And I have a valid StreamedChangeSection for old section
When I create a StreamedChangeWithLineNums with the old section
And I set start_line_included to true
And I set end_line_included to true
And I set new content to multiline text
Then the StreamedChangeWithLineNums instance should be created successfully
And the new content should contain multiple lines
Scenario: Create StreamedChangeWithLineNums using field aliases
Given I import the StreamedChangeWithLineNums class
And I have a valid StreamedChangeSection for old section
When I create a StreamedChangeWithLineNums using aliases
Then the StreamedChangeWithLineNums should accept the aliased fields
And the change values should be properly mapped
Scenario: Validate StreamedChangeWithLineNums configuration
Given I import the StreamedChangeWithLineNums class
When I create a StreamedChangeWithLineNums with valid data
Then the change configuration should have str_strip_whitespace as true
And the change configuration should have validate_assignment as true
And the change configuration should have arbitrary_types_allowed as false
And the change configuration should have populate_by_name as true
And the change configuration should have use_enum_values as true
Scenario: StreamedChangeSection strips whitespace from strings
Given I import the StreamedChangeSection class
When I create a StreamedChangeSection with whitespace in strings
Then the whitespace should be stripped from string fields
And the section should be created successfully
Scenario: StreamedChangeWithLineNums strips whitespace from new content
Given I import the StreamedChangeWithLineNums class
And I have a valid StreamedChangeSection for old section
When I create a StreamedChangeWithLineNums with whitespace in new content
Then the whitespace should be stripped from new field
And the change should be created successfully
Scenario: Complex StreamedChangeWithLineNums with nested section
Given I import the StreamedChangeWithLineNums class
When I create a complex StreamedChangeWithLineNums
Then the nested StreamedChangeSection should be accessible
And all nested fields should be properly initialized
Scenario: StreamedChangeSection with special characters in strings
Given I import the StreamedChangeSection class
When I create a StreamedChangeSection with special characters
Then the special characters should be preserved
And the section should handle unicode properly
Scenario: Validate StreamedChangeSection field types
Given I import the StreamedChangeSection class
When I create a StreamedChangeSection with different field types
Then the integer fields should be validated
And the string fields should be validated
Scenario: Validate StreamedChangeWithLineNums field types
Given I import the StreamedChangeWithLineNums class
And I have a valid StreamedChangeSection for old section
When I create a StreamedChangeWithLineNums with different field types
Then the boolean fields should be validated
And the nested object should be validated
Scenario: StreamedChangeSection with boundary line numbers
Given I import the StreamedChangeSection class
When I create a StreamedChangeSection with start_line 0
And I set end_line to 0
And I set start_line_string to "# First line"
And I set end_line_string to "# First line"
Then the StreamedChangeSection instance should be created successfully
And the start_line should be 0
And the end_line should be 0
Scenario: StreamedChangeWithLineNums represents code deletion
Given I import the StreamedChangeWithLineNums class
And I have a StreamedChangeSection representing lines to delete
When I create a StreamedChangeWithLineNums for deletion
And I set start_line_included to true
And I set end_line_included to true
And I set new content to ""
Then the StreamedChangeWithLineNums instance should represent a deletion
And the old section should contain the deleted content