File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ def _migrate_map(contents: str) -> str:
47
47
48
48
49
49
def _preserve_style (n : ScalarNode , * , s : str ) -> str :
50
- return f'{ n .style } { s } { n .style } '
50
+ style = n .style or ''
51
+ return f'{ style } { s } { style } '
51
52
52
53
53
54
def _fix_stage (n : ScalarNode ) -> str :
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
+ from unittest import mock
4
+
3
5
import pytest
6
+ import yaml
4
7
5
8
import pre_commit .constants as C
6
9
from pre_commit .clientlib import InvalidConfigError
7
10
from pre_commit .commands .migrate_config import migrate_config
11
+ from pre_commit .yaml import yaml_compose
12
+
13
+
14
+ @pytest .fixture (autouse = True , params = ['c' , 'pure' ])
15
+ def switch_pyyaml_impl (request ):
16
+ if request .param == 'c' :
17
+ yield
18
+ else :
19
+ with mock .patch .dict (
20
+ yaml_compose .keywords ,
21
+ {'Loader' : yaml .SafeLoader },
22
+ ):
23
+ yield
8
24
9
25
10
26
def test_migrate_config_normal_format (tmpdir , capsys ):
You can’t perform that action at this time.
0 commit comments