From ff606162bb1f7ebd688894f13b2d8bf3d6ff78c7 Mon Sep 17 00:00:00 2001 From: Doyle Rowland Date: Thu, 24 Jul 2025 14:43:03 -0400 Subject: [PATCH] test: add tests to ensure no regression leading to bug in issue 259 --- .../string_files/do_format_docstrings.toml | 45 +++++++++++++++++++ tests/formatter/test_do_format_docstring.py | 4 ++ 2 files changed, 49 insertions(+) diff --git a/tests/_data/string_files/do_format_docstrings.toml b/tests/_data/string_files/do_format_docstrings.toml index 17345cd..664cf46 100644 --- a/tests/_data/string_files/do_format_docstrings.toml +++ b/tests/_data/string_files/do_format_docstrings.toml @@ -1065,6 +1065,51 @@ expected='''""" :yield: Until test complete, then run cleanup. """''' +[issue_259] +source = '''""" + "xxxxxxxxxxxxx". + + blah. + """''' +expected = '''""""xxxxxxxxxxxxx". + + blah. + """''' + +[issue_259_black] +source = '''""" + "xxxxxxxxxxxxx". + + blah. + """''' +expected = '''""" "xxxxxxxxxxxxx". + + blah. + """''' + +[issue_259_pre_summary_space] +source = '''""" + "xxxxxxxxxxxxx". + + blah. + """''' +expected = '''""" "xxxxxxxxxxxxx". + + blah. + """''' + +[issue_259_pre_summary_newline] +source = '''""" + "xxxxxxxxxxxxx". + + blah. + """''' +expected = '''""" + "xxxxxxxxxxxxx". + + blah. + """''' + [issue_263_sphinx] # the `xx.\n\n` ensures there are a summary and a description sections # the `:param a:` creates a field diff --git a/tests/formatter/test_do_format_docstring.py b/tests/formatter/test_do_format_docstring.py index 50765fd..fb481c9 100644 --- a/tests/formatter/test_do_format_docstring.py +++ b/tests/formatter/test_do_format_docstring.py @@ -172,6 +172,10 @@ ("issue_263_sphinx", NO_ARGS), ("issue_263_epytext", ["-s", "epytext"] + NO_ARGS), ("issue_271", ["--pre-summary-newline"] + WRAP_BOTH_88), + ("issue_259", NO_ARGS), + ("issue_259_black", ["--black"] + NO_ARGS), + ("issue_259_pre_summary_space", ["--pre-summary-space"] + NO_ARGS), + ("issue_259_pre_summary_newline", ["--pre-summary-newline"] + NO_ARGS), ], ) def test_do_format_docstring(test_key, test_args, args):