Skip to content

Wrap sorted literals with black profile settings#2573

Open
HarperZ9 wants to merge 1 commit into
PyCQA:mainfrom
HarperZ9:fix/literal-black-profile-wrapping-1815
Open

Wrap sorted literals with black profile settings#2573
HarperZ9 wants to merge 1 commit into
PyCQA:mainfrom
HarperZ9:fix/literal-black-profile-wrapping-1815

Conversation

@HarperZ9

@HarperZ9 HarperZ9 commented Jul 2, 2026

Copy link
Copy Markdown

Summary

  • make literal sorting use vertical-hanging, parenthesized wrapping when the flat sorted assignment exceeds the configured line length
  • keep existing pprint output for shorter literals and non-vertical modes
  • add regression coverage for # isort: tuple under the Black profile

Closes #1815.

Verification

  • uv run pytest tests/unit/test_literal.py -q
  • uv run ruff check isort/literal.py tests/unit/test_literal.py
  • uv run black --check --fast isort/literal.py tests/unit/test_literal.py
  • uv run mypy isort/literal.py

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.31579% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.94%. Comparing base (01adac1) to head (06e2ee3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2573      +/-   ##
==========================================
- Coverage   99.16%   98.94%   -0.22%     
==========================================
  Files          41       41              
  Lines        3101     3129      +28     
  Branches      671      677       +6     
==========================================
+ Hits         3075     3096      +21     
- Misses         14       19       +5     
- Partials       12       14       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tuple sorting doesn't consider profile

1 participant