Apply typing to all of pre-commit-hooks

This commit is contained in:
Anthony Sottile 2019-01-31 19:19:10 -08:00
parent 63cc3414e9
commit 030bfac7e4
54 changed files with 401 additions and 264 deletions

View file

@ -2,7 +2,7 @@ import os
import pytest
from pre_commit_hooks.check_symlinks import check_symlinks
from pre_commit_hooks.check_symlinks import main
xfail_symlink = pytest.mark.xfail(os.name == 'nt', reason='No symlink support')
@ -12,12 +12,12 @@ xfail_symlink = pytest.mark.xfail(os.name == 'nt', reason='No symlink support')
@pytest.mark.parametrize(
('dest', 'expected'), (('exists', 0), ('does-not-exist', 1)),
)
def test_check_symlinks(tmpdir, dest, expected): # pragma: no cover (symlinks)
def test_main(tmpdir, dest, expected): # pragma: no cover (symlinks)
tmpdir.join('exists').ensure()
symlink = tmpdir.join('symlink')
symlink.mksymlinkto(tmpdir.join(dest))
assert check_symlinks((symlink.strpath,)) == expected
assert main((symlink.strpath,)) == expected
def test_check_symlinks_normal_file(tmpdir):
assert check_symlinks((tmpdir.join('f').ensure().strpath,)) == 0
def test_main_normal_file(tmpdir):
assert main((tmpdir.join('f').ensure().strpath,)) == 0