Avoid removing newlines between docstring headers and rST blocks (#11609)

Given:

```python
def func():
    """
    Example:

    .. code-block:: python

        import foo
    """
```

Removing the newline after the `Example:` header breaks Sphinx
rendering.

See: https://github.com/astral-sh/ruff/issues/11577
This commit is contained in:
Charlie Marsh 2024-05-30 13:29:20 -04:00 committed by GitHub
parent b0a751012e
commit 3aa7e35a4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 254 additions and 26 deletions

View file

@ -46,6 +46,7 @@ mod tests {
#[test_case(Rule::BlankLineBeforeClass, Path::new("D.py"))]
#[test_case(Rule::NoBlankLineBeforeFunction, Path::new("D.py"))]
#[test_case(Rule::BlankLinesBetweenHeaderAndContent, Path::new("sections.py"))]
#[test_case(Rule::BlankLinesBetweenHeaderAndContent, Path::new("sphinx.py"))]
#[test_case(Rule::OverIndentation, Path::new("D.py"))]
#[test_case(Rule::OverIndentation, Path::new("D208.py"))]
#[test_case(Rule::NoSignature, Path::new("D.py"))]