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

# fmt: on does not reactivate in pytest test #1530

Closed
johnthagen opened this issue Jul 5, 2020 · 2 comments
Closed

# fmt: on does not reactivate in pytest test #1530

johnthagen opened this issue Jul 5, 2020 · 2 comments
Labels
T: bug Something isn't working

Comments

@johnthagen
Copy link
Contributor

Describe the bug

# fmt: on doesn't turn back on for pytest test.

To Reproduce

  1. Take this file
import pytest

# fmt: off
@pytest.mark.parametrize('n,expected', [
    (1, 1),
    (2, 2),
    (3, 6),
    (10, 3628800),
])
# fmt: on
def test_factorial(n: int, expected: int) -> None:
    # Too many spaces after assert. Expecting black to format.
    assert   n == expected
  1. Run Black on it with these arguments
[tool.black]
line-length = 99
target-version = ["py36", "py37", "py38"]
(venv) $ black .
  1. See error

Expected behavior

import pytest

# fmt: off
@pytest.mark.parametrize('n,expected', [
    (1, 1),
    (2, 2),
    (3, 6),
    (10, 3628800),
])
# fmt: on
def test_factorial(n: int, expected: int) -> None:
    assert n == expected

Environment (please complete the following information):

  • Version: 19.10b0
  • OS and Python version: Windows 10/3.8.3

Does this bug also happen on master?

No. This may already be fixed in master. The online formatter ran correctly. Please feel free to close if this is a duplicate.

@florczakraf
Copy link

@johnthagen this has already been fixed in #1325 on master indeed. Previous issue related to this problem has been closed after that merge. A new black version that incorporates that patch has not been released yet.

@johnthagen
Copy link
Contributor Author

@florczakraf Thank you. I will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants