def test_line_decoder_cr(): decoder = LineDecoder() assert decoder.decode("") == [] assert decoder.decode("a\r\rb\rc") == ["a\n", "\n", "b\n"] assert decoder.flush() == ["c"] decoder = LineDecoder() assert decoder.decode("") == [] assert decoder.decode("a\r\rb\rc\r") == ["a\n", "\n", "b\n"] assert decoder.flush() == ["c\n"]
def test_line_decoder_nl(): decoder = LineDecoder() assert decoder.decode("") == [] assert decoder.decode("a\n\nb\nc") == ["a\n", "\n", "b\n"] assert decoder.flush() == ["c"] decoder = LineDecoder() assert decoder.decode("") == [] assert decoder.decode("a\n\nb\nc\n") == ["a\n", "\n", "b\n", "c\n"] assert decoder.flush() == []