def _read_patterns(self, binary_stream): negate_patterns = [] patterns = [] for pattern in read_ignore_patterns(binary_stream): if pattern.lstrip().startswith(b"!"): negate_patterns.append(pattern) else: patterns.append(pattern) return negate_patterns, patterns
def test_read_file(self): f = BytesIO(b""" # a comment # and an empty line: \\#not a comment !negative with trailing whitespace with escaped trailing whitespace\\ """) # noqa: W291 self.assertEqual(list(read_ignore_patterns(f)), [ b'\\#not a comment', b'!negative', b'with trailing whitespace', b'with escaped trailing whitespace ' ])
def test_read_file(self): f = BytesIO(b""" # a comment # and an empty line: \#not a comment !negative with trailing whitespace with escaped trailing whitespace\ """) # noqa: W291 self.assertEqual(list(read_ignore_patterns(f)), [ b'\\#not a comment', b'!negative', b'with trailing whitespace', b'with escaped trailing whitespace ' ])
def test_read_file(self): f = BytesIO(b""" # a comment \x20\x20 # and an empty line: \\#not a comment !negative with trailing whitespace with escaped trailing whitespace\\ """) # noqa: W291 self.assertEqual( list(read_ignore_patterns(f)), [ b"\\#not a comment", b"!negative", b"with trailing whitespace", b"with escaped trailing whitespace ", ], )