Skip to content

Commit

Permalink
add test for epytext style too
Browse files Browse the repository at this point in the history
  • Loading branch information
lilatomic committed Jun 30, 2024
1 parent 434fd5e commit 483b31e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
13 changes: 12 additions & 1 deletion tests/_data/string_files/do_format_docstrings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ eBay kinda suss
outstring='''"""eBay kinda suss."""'''

[issue_263]
[issue_263.sphinx]
# the `xx.\n\n` ensures there are a summary and a description sections
# the `:param a:` creates a field
# the `b`s create text that is long enough to trigger a line wrap without being so long that they count as code
Expand All @@ -227,4 +228,14 @@ outstring='''"""xx.
:param a: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
s3://cccc.
"""'''
"""'''
[issue_263.epytext]
instring='''"""xx.
@param a: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb s3://cccc.
"""'''
outstring='''"""xx.
@param a: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
s3://cccc.
"""'''
15 changes: 7 additions & 8 deletions tests/formatter/test_do_format_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,23 +339,22 @@ def test_format_docstring_with_non_cap_words(self, test_args, args):
)

@pytest.mark.unit
@pytest.mark.parametrize("args", [[""]])
def test_idk(self, test_args, args):
@pytest.mark.parametrize("args", [["--style", "sphinx", ""], ["--style", "epytext", ""]])
def test_do_not_double_process_urls(self, test_args, args):
"""Do not double-process urls in fields
See issue #263
"""
style = args[1]

uut = Formatter(
test_args,
sys.stderr,
sys.stdin,
sys.stdout,
)

instring = self.TEST_STRINGS["issue_263"]["instring"]
outstring = self.TEST_STRINGS["issue_263"]["outstring"]
instring = self.TEST_STRINGS["issue_263"][style]["instring"]
outstring = self.TEST_STRINGS["issue_263"][style]["outstring"]

assert outstring == uut._do_format_docstring(
INDENTATION,
instring,
)
assert outstring == uut._do_format_docstring(INDENTATION, instring, )

0 comments on commit 483b31e

Please sign in to comment.