Merge pull request #1683 from pre-commit/textwrap_indent

use textwrap.indent instead of _indent
This commit is contained in:
Anthony Sottile 2020-11-05 16:22:17 -08:00 committed by GitHub
commit 1975c056bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 21 deletions

View file

@ -2,24 +2,9 @@ import pytest
import pre_commit.constants as C
from pre_commit.clientlib import InvalidConfigError
from pre_commit.commands.migrate_config import _indent
from pre_commit.commands.migrate_config import migrate_config
@pytest.mark.parametrize(
('s', 'expected'),
(
('', ''),
('a', ' a'),
('foo\nbar', ' foo\n bar'),
('foo\n\nbar\n', ' foo\n\n bar\n'),
('\n\n\n', '\n\n\n'),
),
)
def test_indent(s, expected):
assert _indent(s) == expected
def test_migrate_config_normal_format(tmpdir, capsys):
cfg = tmpdir.join(C.CONFIG_FILE)
cfg.write(