mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 04:36:52 +00:00
ensure crlf line endings of stdin are handled properly
This commit is contained in:
parent
ff433b2e64
commit
0bf8d2a885
2 changed files with 12 additions and 1 deletions
|
|
@ -1,6 +1,8 @@
|
|||
"""Tests for flake8's utils module."""
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
|
@ -304,3 +306,11 @@ def test_matches_filename_for_excluding_dotfiles():
|
|||
logger = logging.Logger(__name__)
|
||||
assert not utils.matches_filename('.', ('.*',), '', logger)
|
||||
assert not utils.matches_filename('..', ('.*',), '', logger)
|
||||
|
||||
|
||||
@pytest.mark.xfail(sys.version_info < (3,), reason='py3+ only behaviour')
|
||||
def test_stdin_get_value_crlf():
|
||||
"""Ensure that stdin is normalized from crlf to lf."""
|
||||
stdin = io.TextIOWrapper(io.BytesIO(b'1\r\n2\r\n'), 'UTF-8')
|
||||
with mock.patch.object(sys, 'stdin', stdin):
|
||||
assert utils.stdin_get_value.__wrapped__() == '1\n2\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue