Skip to content

Commit

Permalink
Merge pull request #628 from asottile/capture_output_text
Browse files Browse the repository at this point in the history
rewrite check_output(...) universal_newlines -> text
  • Loading branch information
asottile committed Apr 8, 2022
2 parents e4f7820 + a1d1fd7 commit 181f29d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyupgrade/_plugins/subprocess_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def visit_Call(
node.func,
state.from_imports,
('subprocess',),
('run',),
('check_output', 'run'),
)
):
stdout_idx = None
Expand Down
9 changes: 9 additions & 0 deletions tests/features/universal_newlines_to_text_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ def test_fix_universal_newlines_to_text_noop(s, version):
id='subprocess.run attribute',
),
pytest.param(
'import subprocess\n'
'subprocess.check_output(["foo"], universal_newlines=True)\n',
'import subprocess\n'
'subprocess.check_output(["foo"], text=True)\n',
id='subprocess.check_output attribute',
),
pytest.param(
'from subprocess import run\n'
'run(["foo"], universal_newlines=True)\n',
Expand Down

0 comments on commit 181f29d

Please sign in to comment.