# coding=utf-8
from . import VT100Test

class ProcessingTest(VT100Test):
    def test_split_escape_sequences(self):
        assert self.vt.process("abc") == 3
        assert self.vt.process("abc\033[12;24Hdef") == 14

        assert self.vt.process("\033") == 0
        assert self.vt.process("\033[") == 0
        assert self.vt.process("\033[1") == 0
        assert self.vt.process("\033[12") == 0
        assert self.vt.process("\033[12;") == 0
        assert self.vt.process("\033[12;2") == 0
        assert self.vt.process("\033[12;24") == 0
        assert self.vt.process("\033[12;24H") == 8

        assert self.vt.process("abc\033") == 3
        assert self.vt.process("abc\033[") == 3
        assert self.vt.process("abc\033[1") == 3
        assert self.vt.process("abc\033[12") == 3
        assert self.vt.process("abc\033[12;") == 3
        assert self.vt.process("abc\033[12;2") == 3
        assert self.vt.process("abc\033[12;24") == 3
        assert self.vt.process("abc\033[12;24H") == 11

        assert self.vt.process("\033") == 0
        assert self.vt.process("\033[") == 0
        assert self.vt.process("\033[?") == 0
        assert self.vt.process("\033[?1") == 0
        assert self.vt.process("\033[?10") == 0
        assert self.vt.process("\033[?100") == 0
        assert self.vt.process("\033[?1000") == 0
        assert self.vt.process("\033[?1000h") == 8

        assert self.vt.process("\033]") == 0
        assert self.vt.process("\033]4") == 0
        assert self.vt.process("\033]49") == 0
        assert self.vt.process("\033]499") == 0
        assert self.vt.process("\033]499;") == 0
        assert self.vt.process("\033]499;a") == 0
        assert self.vt.process("\033]499;a ") == 0
        assert self.vt.process("\033]499;a '") == 0
        assert self.vt.process("\033]499;a '[") == 0
        assert self.vt.process("\033]499;a '[]") == 0
        assert self.vt.process("\033]499;a '[]_") == 0
        assert self.vt.process("\033]499;a '[]_\007") == 13

    def test_split_utf8(self):
        assert self.vt.process("a") == 1

        assert self.vt.process(b"\303") == 0
        assert self.vt.process(b"\303\241") == 2
        assert self.vt.process("á") == 2

        assert self.vt.process(b"\343") == 0
        assert self.vt.process(b"\343\202") == 0
        assert self.vt.process(b"\343\202\255") == 3
        assert self.vt.process("キ") == 3

        assert self.vt.process(b"\360") == 0
        assert self.vt.process(b"\360\237") == 0
        assert self.vt.process(b"\360\237\222") == 0
        assert self.vt.process(b"\360\237\222\251") == 4
        assert self.vt.process("💩") == 4

bbb44d4ac61855add3db06d9a401aba92fbed89d
<mask token>


class ProcessingTest(VT100Test):
    <mask token>
    <mask token>

<mask token>


class ProcessingTest(VT100Test):

    def test_split_escape_sequences(self):
        assert self.vt.process('abc') == 3
        assert self.vt.process('abc\x1b[12;24Hdef') == 14
        assert self.vt.process('\x1b') == 0
        assert self.vt.process('\x1b[') == 0
        assert self.vt.process('\x1b[1') == 0
        assert self.vt.process('\x1b[12') == 0
        assert self.vt.process('\x1b[12;') == 0
        assert self.vt.process('\x1b[12;2') == 0
        assert self.vt.process('\x1b[12;24') == 0
        assert self.vt.process('\x1b[12;24H') == 8
        assert self.vt.process('abc\x1b') == 3
        assert self.vt.process('abc\x1b[') == 3
        assert self.vt.process('abc\x1b[1') == 3
        assert self.vt.process('abc\x1b[12') == 3
        assert self.vt.process('abc\x1b[12;') == 3
        assert self.vt.process('abc\x1b[12;2') == 3
        assert self.vt.process('abc\x1b[12;24') == 3
        assert self.vt.process('abc\x1b[12;24H') == 11
        assert self.vt.process('\x1b') == 0
        assert self.vt.process('\x1b[') == 0
        assert self.vt.process('\x1b[?') == 0
        assert self.vt.process('\x1b[?1') == 0
        assert self.vt.process('\x1b[?10') == 0
        assert self.vt.process('\x1b[?100') == 0
        assert self.vt.process('\x1b[?1000') == 0
        assert self.vt.process('\x1b[?1000h') == 8
        assert self.vt.process('\x1b]') == 0
        assert self.vt.process('\x1b]4') == 0
        assert self.vt.process('\x1b]49') == 0
        assert self.vt.process('\x1b]499') == 0
        assert self.vt.process('\x1b]499;') == 0
        assert self.vt.process('\x1b]499;a') == 0
        assert self.vt.process('\x1b]499;a ') == 0
        assert self.vt.process("\x1b]499;a '") == 0
        assert self.vt.process("\x1b]499;a '[") == 0
        assert self.vt.process("\x1b]499;a '[]") == 0
        assert self.vt.process("\x1b]499;a '[]_") == 0
        assert self.vt.process("\x1b]499;a '[]_\x07") == 13
    <mask token>

<mask token>


class ProcessingTest(VT100Test):

    def test_split_escape_sequences(self):
        assert self.vt.process('abc') == 3
        assert self.vt.process('abc\x1b[12;24Hdef') == 14
        assert self.vt.process('\x1b') == 0
        assert self.vt.process('\x1b[') == 0
        assert self.vt.process('\x1b[1') == 0
        assert self.vt.process('\x1b[12') == 0
        assert self.vt.process('\x1b[12;') == 0
        assert self.vt.process('\x1b[12;2') == 0
        assert self.vt.process('\x1b[12;24') == 0
        assert self.vt.process('\x1b[12;24H') == 8
        assert self.vt.process('abc\x1b') == 3
        assert self.vt.process('abc\x1b[') == 3
        assert self.vt.process('abc\x1b[1') == 3
        assert self.vt.process('abc\x1b[12') == 3
        assert self.vt.process('abc\x1b[12;') == 3
        assert self.vt.process('abc\x1b[12;2') == 3
        assert self.vt.process('abc\x1b[12;24') == 3
        assert self.vt.process('abc\x1b[12;24H') == 11
        assert self.vt.process('\x1b') == 0
        assert self.vt.process('\x1b[') == 0
        assert self.vt.process('\x1b[?') == 0
        assert self.vt.process('\x1b[?1') == 0
        assert self.vt.process('\x1b[?10') == 0
        assert self.vt.process('\x1b[?100') == 0
        assert self.vt.process('\x1b[?1000') == 0
        assert self.vt.process('\x1b[?1000h') == 8
        assert self.vt.process('\x1b]') == 0
        assert self.vt.process('\x1b]4') == 0
        assert self.vt.process('\x1b]49') == 0
        assert self.vt.process('\x1b]499') == 0
        assert self.vt.process('\x1b]499;') == 0
        assert self.vt.process('\x1b]499;a') == 0
        assert self.vt.process('\x1b]499;a ') == 0
        assert self.vt.process("\x1b]499;a '") == 0
        assert self.vt.process("\x1b]499;a '[") == 0
        assert self.vt.process("\x1b]499;a '[]") == 0
        assert self.vt.process("\x1b]499;a '[]_") == 0
        assert self.vt.process("\x1b]499;a '[]_\x07") == 13

    def test_split_utf8(self):
        assert self.vt.process('a') == 1
        assert self.vt.process(b'\xc3') == 0
        assert self.vt.process(b'\xc3\xa1') == 2
        assert self.vt.process('á') == 2
        assert self.vt.process(b'\xe3') == 0
        assert self.vt.process(b'\xe3\x82') == 0
        assert self.vt.process(b'\xe3\x82\xad') == 3
        assert self.vt.process('キ') == 3
        assert self.vt.process(b'\xf0') == 0
        assert self.vt.process(b'\xf0\x9f') == 0
        assert self.vt.process(b'\xf0\x9f\x92') == 0
        assert self.vt.process(b'\xf0\x9f\x92\xa9') == 4
        assert self.vt.process('💩') == 4

from . import VT100Test


class ProcessingTest(VT100Test):

    def test_split_escape_sequences(self):
        assert self.vt.process('abc') == 3
        assert self.vt.process('abc\x1b[12;24Hdef') == 14
        assert self.vt.process('\x1b') == 0
        assert self.vt.process('\x1b[') == 0
        assert self.vt.process('\x1b[1') == 0
        assert self.vt.process('\x1b[12') == 0
        assert self.vt.process('\x1b[12;') == 0
        assert self.vt.process('\x1b[12;2') == 0
        assert self.vt.process('\x1b[12;24') == 0
        assert self.vt.process('\x1b[12;24H') == 8
        assert self.vt.process('abc\x1b') == 3
        assert self.vt.process('abc\x1b[') == 3
        assert self.vt.process('abc\x1b[1') == 3
        assert self.vt.process('abc\x1b[12') == 3
        assert self.vt.process('abc\x1b[12;') == 3
        assert self.vt.process('abc\x1b[12;2') == 3
        assert self.vt.process('abc\x1b[12;24') == 3
        assert self.vt.process('abc\x1b[12;24H') == 11
        assert self.vt.process('\x1b') == 0
        assert self.vt.process('\x1b[') == 0
        assert self.vt.process('\x1b[?') == 0
        assert self.vt.process('\x1b[?1') == 0
        assert self.vt.process('\x1b[?10') == 0
        assert self.vt.process('\x1b[?100') == 0
        assert self.vt.process('\x1b[?1000') == 0
        assert self.vt.process('\x1b[?1000h') == 8
        assert self.vt.process('\x1b]') == 0
        assert self.vt.process('\x1b]4') == 0
        assert self.vt.process('\x1b]49') == 0
        assert self.vt.process('\x1b]499') == 0
        assert self.vt.process('\x1b]499;') == 0
        assert self.vt.process('\x1b]499;a') == 0
        assert self.vt.process('\x1b]499;a ') == 0
        assert self.vt.process("\x1b]499;a '") == 0
        assert self.vt.process("\x1b]499;a '[") == 0
        assert self.vt.process("\x1b]499;a '[]") == 0
        assert self.vt.process("\x1b]499;a '[]_") == 0
        assert self.vt.process("\x1b]499;a '[]_\x07") == 13

    def test_split_utf8(self):
        assert self.vt.process('a') == 1
        assert self.vt.process(b'\xc3') == 0
        assert self.vt.process(b'\xc3\xa1') == 2
        assert self.vt.process('á') == 2
        assert self.vt.process(b'\xe3') == 0
        assert self.vt.process(b'\xe3\x82') == 0
        assert self.vt.process(b'\xe3\x82\xad') == 3
        assert self.vt.process('キ') == 3
        assert self.vt.process(b'\xf0') == 0
        assert self.vt.process(b'\xf0\x9f') == 0
        assert self.vt.process(b'\xf0\x9f\x92') == 0
        assert self.vt.process(b'\xf0\x9f\x92\xa9') == 4
        assert self.vt.process('💩') == 4

# coding=utf-8
from . import VT100Test

class ProcessingTest(VT100Test):
    def test_split_escape_sequences(self):
        assert self.vt.process("abc") == 3
        assert self.vt.process("abc\033[12;24Hdef") == 14

        assert self.vt.process("\033") == 0
        assert self.vt.process("\033[") == 0
        assert self.vt.process("\033[1") == 0
        assert self.vt.process("\033[12") == 0
        assert self.vt.process("\033[12;") == 0
        assert self.vt.process("\033[12;2") == 0
        assert self.vt.process("\033[12;24") == 0
        assert self.vt.process("\033[12;24H") == 8

        assert self.vt.process("abc\033") == 3
        assert self.vt.process("abc\033[") == 3
        assert self.vt.process("abc\033[1") == 3
        assert self.vt.process("abc\033[12") == 3
        assert self.vt.process("abc\033[12;") == 3
        assert self.vt.process("abc\033[12;2") == 3
        assert self.vt.process("abc\033[12;24") == 3
        assert self.vt.process("abc\033[12;24H") == 11

        assert self.vt.process("\033") == 0
        assert self.vt.process("\033[") == 0
        assert self.vt.process("\033[?") == 0
        assert self.vt.process("\033[?1") == 0
        assert self.vt.process("\033[?10") == 0
        assert self.vt.process("\033[?100") == 0
        assert self.vt.process("\033[?1000") == 0
        assert self.vt.process("\033[?1000h") == 8

        assert self.vt.process("\033]") == 0
        assert self.vt.process("\033]4") == 0
        assert self.vt.process("\033]49") == 0
        assert self.vt.process("\033]499") == 0
        assert self.vt.process("\033]499;") == 0
        assert self.vt.process("\033]499;a") == 0
        assert self.vt.process("\033]499;a ") == 0
        assert self.vt.process("\033]499;a '") == 0
        assert self.vt.process("\033]499;a '[") == 0
        assert self.vt.process("\033]499;a '[]") == 0
        assert self.vt.process("\033]499;a '[]_") == 0
        assert self.vt.process("\033]499;a '[]_\007") == 13

    def test_split_utf8(self):
        assert self.vt.process("a") == 1

        assert self.vt.process(b"\303") == 0
        assert self.vt.process(b"\303\241") == 2
        assert self.vt.process("á") == 2

        assert self.vt.process(b"\343") == 0
        assert self.vt.process(b"\343\202") == 0
        assert self.vt.process(b"\343\202\255") == 3
        assert self.vt.process("キ") == 3

        assert self.vt.process(b"\360") == 0
        assert self.vt.process(b"\360\237") == 0
        assert self.vt.process(b"\360\237\222") == 0
        assert self.vt.process(b"\360\237\222\251") == 4
        assert self.vt.process("💩") == 4
