mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-12 05:54:18 +00:00
Upgrade add-trailing-comma to 0.4.1
This commit is contained in:
parent
ea227f024b
commit
e9aea74a77
11 changed files with 94 additions and 63 deletions
|
|
@ -7,26 +7,30 @@ import pytest
|
|||
from pre_commit_hooks.check_executables_have_shebangs import main
|
||||
|
||||
|
||||
@pytest.mark.parametrize('content', (
|
||||
b'#!/bin/bash\nhello world\n',
|
||||
b'#!/usr/bin/env python3.6',
|
||||
b'#!python',
|
||||
'#!☃'.encode('UTF-8'),
|
||||
))
|
||||
@pytest.mark.parametrize(
|
||||
'content', (
|
||||
b'#!/bin/bash\nhello world\n',
|
||||
b'#!/usr/bin/env python3.6',
|
||||
b'#!python',
|
||||
'#!☃'.encode('UTF-8'),
|
||||
),
|
||||
)
|
||||
def test_has_shebang(content, tmpdir):
|
||||
path = tmpdir.join('path')
|
||||
path.write(content, 'wb')
|
||||
assert main((path.strpath,)) == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize('content', (
|
||||
b'',
|
||||
b' #!python\n',
|
||||
b'\n#!python\n',
|
||||
b'python\n',
|
||||
'☃'.encode('UTF-8'),
|
||||
@pytest.mark.parametrize(
|
||||
'content', (
|
||||
b'',
|
||||
b' #!python\n',
|
||||
b'\n#!python\n',
|
||||
b'python\n',
|
||||
'☃'.encode('UTF-8'),
|
||||
|
||||
))
|
||||
),
|
||||
)
|
||||
def test_bad_shebang(content, tmpdir, capsys):
|
||||
path = tmpdir.join('path')
|
||||
path.write(content, 'wb')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue