Ejemplo n.º 1
0
    def test_single_line_chunks(self):
        def reader():
            yield "abc\n"
            yield "def\n"
            yield "ghi\n"

        self.assertEqual(list(split_buffer(reader(), '\n')), ["abc\n", "def\n", "ghi\n"])
Ejemplo n.º 2
0
    def test_no_end_separator(self):
        def reader():
            yield "abc\n"
            yield "def\n"
            yield "ghi"

        self.assertEqual(list(split_buffer(reader(), '\n')), ["abc\n", "def\n", "ghi"])
Ejemplo n.º 3
0
    def test_single_line_chunks(self):
        def reader():
            yield "abc\n"
            yield "def\n"
            yield "ghi\n"

        self.assertEqual(list(split_buffer(reader(), '\n')),
                         ["abc\n", "def\n", "ghi\n"])
Ejemplo n.º 4
0
    def test_no_end_separator(self):
        def reader():
            yield "abc\n"
            yield "def\n"
            yield "ghi"

        self.assertEqual(list(split_buffer(reader(), '\n')),
                         ["abc\n", "def\n", "ghi"])
Ejemplo n.º 5
0
    def test_chunked_line(self):
        def reader():
            yield "a"
            yield "b"
            yield "c"
            yield "\n"
            yield "d"

        self.assertEqual(list(split_buffer(reader(), '\n')), ["abc\n", "d"])
Ejemplo n.º 6
0
    def test_chunked_line(self):
        def reader():
            yield "a"
            yield "b"
            yield "c"
            yield "\n"
            yield "d"

        self.assertEqual(list(split_buffer(reader(), '\n')), ["abc\n", "d"])
Ejemplo n.º 7
0
    def test_multiple_line_chunk(self):
        def reader():
            yield "abc\ndef\nghi"

        self.assertEqual(list(split_buffer(reader(), '\n')),
                         ["abc\n", "def\n", "ghi"])
Ejemplo n.º 8
0
    def test_multiple_line_chunk(self):
        def reader():
            yield "abc\ndef\nghi"

        self.assertEqual(list(split_buffer(reader(), '\n')), ["abc\n", "def\n", "ghi"])
Ejemplo n.º 9
0
    def assert_produces(self, reader, expectations):
        split = split_buffer(reader(), b'\n')

        for (actual, expected) in zip(split, expectations):
            self.assertEqual(type(actual), type(expected))
            self.assertEqual(actual, expected)