Skip to content

Support multi-line subsection descriptions in test docstrings via indentation#4

Merged
alithethird merged 3 commits intorule_65_aifrom
copilot/remove-dot-requirement-test-docs
Nov 9, 2025
Merged

Support multi-line subsection descriptions in test docstrings via indentation#4
alithethird merged 3 commits intorule_65_aifrom
copilot/remove-dot-requirement-test-docs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 9, 2025

Test docstrings using arrange:/act:/assert: or given:/when:/then: patterns required each line to be self-contained. Multi-line descriptions now use indentation to indicate continuation.

Changes

Parser logic (src/docstring.rs):

  • Modified _get_sections() to recognize indented lines without : as continuations
  • Changed from filter_map to explicit loop for continuation line handling

Python bindings (src/lib.rs, src/docstring.rs):

  • Added #[getter] methods for _Section.name and _Section.subs
  • Exported _get_sections to Python module

Tests:

  • 4 Rust unit tests covering multiline patterns
  • 4 Python integration tests
  • Example file demonstrating usage

Example

Before:

def test_something():
    """
    arrange: Setup.
    act: Test.
    assert: Check.
    """

After:

def test_something():
    """
    arrange: Complex test setup requiring detailed explanation that
        spans multiple lines with proper indentation.
    act: Execute the test.
    assert: Verify expected behavior with detailed assertions.
    """

All existing docstrings remain valid. All 236 tests pass.

Original prompt

This section details on the original issue you should resolve

<issue_title>Every line in test docstrings has to end with .</issue_title>
<issue_description>In the test docstrings every line has to end with a .. This is not nice. Sometimes the docstring has to be tall and span a couple of lines.

We can use indentation to show that the sentence is continous.

Example:

def test_something():
    """
    arrange: This is a very important part of a very important test so
        the arrange sentence has to be loooong.
    act: Do the test.
    assert: It better not fail 😠.
    """
```</issue_description>

<agent_instructions>Remove the necessity to have comma at the end of each line in test docstrings and write tests to make sure it is working as intended
</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 9, 2025 13:55
…tinuation

Modified _get_sections to properly handle multi-line subsections where continuation
lines are identified by indentation. This allows test docstrings using arrange/act/assert
or given/when/then patterns to have descriptions that span multiple lines without
requiring each line to end with a period.

Co-authored-by: alithethird <39213991+alithethird@users.noreply.github.com>
- Added Python integration tests to verify multiline subsection support
- Added getters for _Section.name and _Section.subs to make them accessible from Python
- Exported _get_sections function to Python module
- Created example file demonstrating the new feature
- All 236 tests pass (230 Rust + 6 new tests)

Co-authored-by: alithethird <39213991+alithethird@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove requirement for dot at end of test docstrings Support multi-line subsection descriptions in test docstrings via indentation Nov 9, 2025
Copilot AI requested a review from alithethird November 9, 2025 14:09
@alithethird alithethird marked this pull request as ready for review November 9, 2025 14:25
@alithethird alithethird merged commit 8a10c4b into rule_65_ai Nov 9, 2025
@alithethird alithethird deleted the copilot/remove-dot-requirement-test-docs branch November 9, 2025 14:26
alithethird added a commit that referenced this pull request Dec 3, 2025
…-test-docs

Support multi-line subsection descriptions in test docstrings via indentation
alithethird added a commit that referenced this pull request Dec 19, 2025
…-test-docs

Support multi-line subsection descriptions in test docstrings via indentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants