Skip to content

Commit

Permalink
checker: Added checkers for too more empty lines - fix: #4
Browse files Browse the repository at this point in the history
  • Loading branch information
andras-tim committed Jul 14, 2017
1 parent ccdb2c3 commit 72d6d47
Show file tree
Hide file tree
Showing 6 changed files with 294 additions and 324 deletions.
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
307 changes: 0 additions & 307 deletions tests/unit/test_checker.py

This file was deleted.

25 changes: 25 additions & 0 deletions tests/unit/test_checker_check_file.py
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)
Loading

0 comments on commit 72d6d47

Please sign in to comment.