-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checker: Added checkers for too more empty lines - fix: #4
- Loading branch information
1 parent
ccdb2c3
commit 72d6d47
Showing
6 changed files
with
294 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ pytest>=2.9.2 | |
pytest-cache>=1.0 | ||
pytest-cov>=2.3.0 | ||
pytest-flake8>=0.6 | ||
pytest-mock>=1.6.0 | ||
sphinx>=1.6,<1.7 |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pytest | ||
|
||
from wscheck.checker import WhitespaceChecker | ||
from tests.unit.open_mock import patch_open_read | ||
|
||
|
||
@pytest.fixture | ||
def checker(mocker): | ||
instance = WhitespaceChecker() | ||
mocker.patch.object(instance, 'check_text', auto_spec=True) | ||
|
||
return instance | ||
|
||
|
||
@pytest.mark.parametrize('file_path,file_content', [ | ||
('/empty/file', ''), | ||
('/contains/anything', ' foo\t\r\nbar '), | ||
]) | ||
def test_one_empty_line_is_good(checker, file_path, file_content): | ||
mocked_files = {file_path: file_content} | ||
|
||
with patch_open_read(mocked_files): | ||
checker.check_file(file_path) | ||
|
||
checker.check_text.assert_called_once_with(file_content, source_path=file_path) |
Oops, something went wrong.