Skip to content

Commit

Permalink
Merge pull request #2236 from MrMino/black-magic-comma
Browse files Browse the repository at this point in the history
Black profile: enable magic comma
  • Loading branch information
staticdev authored Jan 17, 2025
2 parents 4ae58fa + ce5b0dc commit 1c8d963
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/configuration/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ To use any of the listed profiles, use `isort --profile PROFILE_NAME` from the c

- **multi_line_output**: `3`
- **include_trailing_comma**: `True`
- **split_on_trailing_comma**: `True`
- **force_grid_wrap**: `0`
- **use_parentheses**: `True`
- **ensure_newline_before_comments**: `True`
Expand Down
1 change: 1 addition & 0 deletions isort/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
black = {
"multi_line_output": 3,
"include_trailing_comma": True,
"split_on_trailing_comma": True,
"force_grid_wrap": 0,
"use_parentheses": True,
"ensure_newline_before_comments": True,
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/profiles/test_black.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,3 +443,16 @@ def sub(a: np.ndarray, b: np.ndarray) -> np.ndarray: ...
lines_before_imports=2, # will be ignored
lines_after_imports=2, # will be ignored
)


def test_black_trailing_comma():
black_test(
"from x import (a, b, c,)\n",
"""\
from x import (
a,
b,
c,
)
""",
)

0 comments on commit 1c8d963

Please sign in to comment.