mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 03:56:54 +00:00
Adding detect-raw-datetime-manipulation option
This commit is contained in:
parent
2dbaced650
commit
6932b83509
8 changed files with 161 additions and 1 deletions
24
tests/detect_raw_datetime_manipulation_test.py
Normal file
24
tests/detect_raw_datetime_manipulation_test.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from pre_commit_hooks.detect_datetime_raw_manipulation import _check_file
|
||||
from pre_commit_hooks.detect_datetime_raw_manipulation import main
|
||||
from testing.util import get_resource_path
|
||||
|
||||
|
||||
def test_flagged_file():
|
||||
rc = main([get_resource_path('detect_datetime_raw_manipulation/raw_timedelta_usage__flag.py')])
|
||||
assert rc == 1
|
||||
|
||||
result = _check_file(get_resource_path('detect_datetime_raw_manipulation/raw_timedelta_usage__flag.py'))
|
||||
assert result == 10
|
||||
|
||||
|
||||
def test_flagged_ignore():
|
||||
rc = main([get_resource_path('detect_datetime_raw_manipulation/raw_timedelta_usage__ignore.py')])
|
||||
assert rc == 0
|
||||
|
||||
|
||||
def test_flagged_clean():
|
||||
rc = main([get_resource_path('detect_datetime_raw_manipulation/raw_timedelta_usage__clean.py')])
|
||||
assert rc == 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue