Example #1
0
def test_parse_plain():
    assert parse('plaintext') == [Text('plaintext')]
Example #2
0
def test_parse_low_colors():
    assert parse('some\x1b[36;44mcolor') == [Text('some'), Text('color', bg='#000080', fg='#008080')]
Example #3
0
def test_parse_bold():
    assert parse('\x1b[1mfoo') == [Text('foo', bold=True)]
Example #4
0
def test_parse_multiple_sequences():
    assert parse('\x1b[1m\x1b[33mfoo') == [Text('foo', bold=True, fg='#808000')]
Example #5
0
def test_parse_grayscale():
    assert parse('\x1b[38;5;243mword') == [Text('word', fg='#767676')]
Example #6
0
def test_parse_reset():
    assert parse('foo\x1b[31mbar\x1b[0mbaz') == [Text('foo'), Text('bar', fg='#800000'), Text('baz')]
Example #7
0
def test_parse_color_cube():
    assert parse('\x1b[38;5;16mword') == [Text('word', fg='#000000')]
    assert parse('\x1b[38;5;42mword') == [Text('word', fg='#00d787')]
Example #8
0
def test_parse_empty():
    assert parse('') == []
Example #9
0
def test_parse_256_high():
    assert parse('\x1b[38;5;8;48;5;9mword') == [Text('word', bg='#ff0000', fg='#808080')]
Example #10
0
def test_parse_256_low():
    assert parse('\x1b[38;5;1;48;5;2mword') == [Text('word', bg='#008000', fg='#800000')]
Example #11
0
def test_parse_low_colors():
    assert parse('some\x1b[96;104mcolor') == [Text('some'), Text('color', bg='#0000ff', fg='#00ffff')]