提交 013b014b 编辑于 作者: Pavel Bitiukov's avatar Pavel Bitiukov
浏览文件

Removed check for include_trailing_comma for the Hanging Indent wrap mode

显示 18 个添加3 个删除
+18 -3
......@@ -141,9 +141,6 @@ def hanging_indent(**interface: Any) -> str:
)
interface["statement"] = next_statement
interface[
"statement"
] = f"{interface['statement']}{',' if interface['include_trailing_comma'] else ''}"
if interface["comments"]:
statement_with_comments = isort.comments.add_to_line(
interface["comments"],
......
......@@ -259,6 +259,24 @@ def test_fuzz_hanging_indent(
reject()
@pytest.mark.parametrize("include_trailing_comma", (True, False))
def test_hanging_indent__with_include_trailing_comma__expect_same_result(include_trailing_comma):
result = isort.wrap_modes.hanging_indent(
statement="from datetime import ",
imports=["datetime", "time", "timedelta", "timezone", "tzinfo"],
white_space=" ",
indent=" ",
line_length=50,
comments=[],
line_separator="\n",
comment_prefix=" #",
include_trailing_comma=include_trailing_comma,
remove_comments=False,
)
assert result == "from datetime import datetime, time, timedelta, \\\n timezone, tzinfo"
@given(
statement=st.text(),
imports=st.lists(st.text()),
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册