Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --unstable flag #4096

Merged
merged 53 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
18e711f
Allow empty lines at beginning of blocks (again)
JelleZijlstra Nov 21, 2023
d753703
reformat
JelleZijlstra Nov 21, 2023
129349c
update comments
JelleZijlstra Nov 21, 2023
51bb901
Many uncontroverisal preview changes
JelleZijlstra Nov 21, 2023
c71b5e2
more relatively noncontroversial features
JelleZijlstra Nov 21, 2023
cc3780f
Update some tests
JelleZijlstra Nov 21, 2023
bb31678
Enable two more
JelleZijlstra Nov 21, 2023
337a85d
Merge branch 'main' into 241a1really
JelleZijlstra Dec 10, 2023
37f8ed0
Remove obsolete features
JelleZijlstra Dec 10, 2023
be46470
Fix up merge
JelleZijlstra Dec 10, 2023
7712a74
Add --unstable flag
JelleZijlstra Dec 10, 2023
6238e38
self
JelleZijlstra Dec 10, 2023
47221c9
fine
JelleZijlstra Dec 10, 2023
3fd83e0
Merge branch 'main' into 241a1really
JelleZijlstra Dec 11, 2023
6e8871b
Fix the worst issues
JelleZijlstra Dec 11, 2023
10f6449
fix some tests
JelleZijlstra Dec 11, 2023
c27daf6
Update tests
JelleZijlstra Dec 11, 2023
dc2d104
Fix another dummy impl case
JelleZijlstra Dec 11, 2023
b073cbd
fix some more
JelleZijlstra Dec 11, 2023
034fd94
Merge branch 'main' into 241a1really
JelleZijlstra Dec 11, 2023
acb8c7c
unused imports
JelleZijlstra Dec 11, 2023
27c8a34
Fix feature detection for parenthesized CMs
JelleZijlstra Dec 12, 2023
0302e8d
changelog
JelleZijlstra Dec 12, 2023
6794240
Merge branch 'main' into 241a1really
JelleZijlstra Dec 12, 2023
9886590
Merge remote-tracking branch 'upstream/main' into black24
JelleZijlstra Jan 4, 2024
7f7eb72
Fix up
JelleZijlstra Jan 4, 2024
280ec86
Merge branch 'main' into black24
JelleZijlstra Jan 24, 2024
975e7f1
wrap_long_dict_values_in_parens and multiline_string_handling back to…
JelleZijlstra Jan 24, 2024
073ee3f
bad merge
JelleZijlstra Jan 24, 2024
8758f3c
fix tests
JelleZijlstra Jan 24, 2024
a9ca9a4
fix more tests
JelleZijlstra Jan 24, 2024
47449ff
Remove --preview from some tests
JelleZijlstra Jan 24, 2024
a646358
changelog
JelleZijlstra Jan 24, 2024
c4f42c6
Merge branch 'main' into unstable
JelleZijlstra Jan 24, 2024
5d2d735
Merge branch 'black24' into unstable
JelleZijlstra Jan 24, 2024
7836fb9
docs, blackd
JelleZijlstra Jan 24, 2024
5eaba4a
Format ourselves unstably
JelleZijlstra Jan 24, 2024
718ce47
fix test
JelleZijlstra Jan 24, 2024
27bcbc5
Merge branch 'main' into unstable
JelleZijlstra Jan 25, 2024
5411e74
Merge branch 'main' into unstable
JelleZijlstra Jan 25, 2024
cb9bc00
one more
JelleZijlstra Jan 25, 2024
9bfeae2
Add separate flags for --unstable features
JelleZijlstra Jan 25, 2024
9389390
Clean up obsolete preview tests
JelleZijlstra Jan 25, 2024
07eccbe
docs, blackd
JelleZijlstra Jan 25, 2024
81ab9cc
some tests
JelleZijlstra Jan 25, 2024
926bbde
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 25, 2024
1755897
ugh 3.8
JelleZijlstra Jan 25, 2024
3a7310f
note replacement
JelleZijlstra Jan 25, 2024
a1b4dca
lint
JelleZijlstra Jan 25, 2024
47ea1d2
Remove broken and disabled test
JelleZijlstra Jan 25, 2024
e21787f
lint the lint
JelleZijlstra Jan 25, 2024
09c1fb5
Allow --enable-unstable-feature for preview features
JelleZijlstra Jan 26, 2024
9cc105b
Expand changelog
JelleZijlstra Jan 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
some tests
  • Loading branch information
JelleZijlstra committed Jan 25, 2024
commit 81ab9cc62c93558c2dd503d653fc97328f48a25f
3 changes: 2 additions & 1 deletion src/black/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ def main( # noqa: C901
out(main.get_usage(ctx) + "\n\nOne of 'SRC' or 'code' is required.")
ctx.exit(1)

if enable_unstable_feature and not preview:
# It doesn't do anything if --unstable is also passed, so just allow it.
if enable_unstable_feature and not (preview or unstable):
out(
main.get_usage(ctx)
+ "\n\n'--enable-unstable-feature' requires '--preview'."
Expand Down
16 changes: 16 additions & 0 deletions tests/test_black.py
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,22 @@ def get_output(*args: Any, **kwargs: Any) -> io.TextIOWrapper:
pass # StringIO does not support detach
assert output.getvalue() == expected

def test_cli_unstable(self) -> None:
self.invokeBlack(["--unstable", "-c", "0"], exit_code=0)
self.invokeBlack(["--preview", "-c", "0"], exit_code=0)
# Must also pass --preview
self.invokeBlack(
["--enable-unstable-feature", "string_processing", "-c", "0"], exit_code=1
)
self.invokeBlack(
["--preview", "--enable-unstable-feature", "string_processing", "-c", "0"],
exit_code=0,
)
self.invokeBlack(
["--unstable", "--enable-unstable-feature", "string_processing", "-c", "0"],
exit_code=0,
)

def test_invalid_cli_regex(self) -> None:
for option in ["--include", "--exclude", "--extend-exclude", "--force-exclude"]:
self.invokeBlack(["-", option, "**()(!!*)"], exit_code=2)
Expand Down
Loading