"""Test text utils.""" import pytest from video.utils import text @pytest.mark.parametrize( ('bytes_', 'lines'), [ ('abc'.encode('utf-8'), ['abc']), ('abc'.encode('iso-8859-1'), ['abc']), ('abc\r\n'.encode('utf-8'), ['abc', '']), ('abc\r\n'.encode('iso-8859-1'), ['abc', '']), ('abc\r\n123'.encode('utf-8'), ['abc', '123']), ('abc\r\n123'.encode('iso-8859-1'), ['abc', '123']), ('abc\r'.encode('utf-8'), ['abc', '']), ('abc\r'.encode('iso-8859-1'), ['abc', '']), ('abc\r123'.encode('utf-8'), ['abc', '123']), ('abc\r123'.encode('iso-8859-1'), ['abc', '123']), ('abc\n'.encode('utf-8'), ['abc', '']), ('abc\n'.encode('iso-8859-1'), ['abc', '']), ('abc\n123'.encode('utf-8'), ['abc', '123']), ('abc\n123'.encode('iso-8859-1'), ['abc', '123']), ] ) def test_bytes_to_lines_of_text(bytes_, lines): """Test bytes_to_lines_of_text.""" assert lines == text.bytes_to_lines_of_text(bytes_)