Exemple #1
0
def test_parse_plain():
    assert parse('plaintext') == [Text('plaintext')]
Exemple #2
0
def test_parse_low_colors():
    assert parse('some\x1b[36;44mcolor') == [Text('some'), Text('color', bg='#000080', fg='#008080')]
Exemple #3
0
def test_html_all_attributes():
    assert Text('foo', bg='#808000', fg='#800000', bold=True).to_html() == \
            '<span style="background-color: #808000; color: #800000; font-weight: bold">foo</span>'
Exemple #4
0
def test_html_escaped():
    assert Text('<title>').to_html() == '&lt;title&gt;'
Exemple #5
0
def test_parse_multiple_sequences():
    assert parse('\x1b[1m\x1b[33mfoo') == [Text('foo', bold=True, fg='#808000')]
Exemple #6
0
def test_html_plain():
    assert Text('foo').to_html() == 'foo'
Exemple #7
0
def test_parse_reset():
    assert parse('foo\x1b[31mbar\x1b[0mbaz') == [Text('foo'), Text('bar', fg='#800000'), Text('baz')]
Exemple #8
0
def test_parse_bold():
    assert parse('\x1b[1mfoo') == [Text('foo', bold=True)]
Exemple #9
0
def test_parse_grayscale():
    assert parse('\x1b[38;5;243mword') == [Text('word', fg='#767676')]
Exemple #10
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')]
Exemple #11
0
def test_parse_256_high():
    assert parse('\x1b[38;5;8;48;5;9mword') == [Text('word', bg='#ff0000', fg='#808080')]
Exemple #12
0
def test_parse_256_low():
    assert parse('\x1b[38;5;1;48;5;2mword') == [Text('word', bg='#008000', fg='#800000')]
Exemple #13
0
def test_parse_low_colors():
    assert parse('some\x1b[96;104mcolor') == [Text('some'), Text('color', bg='#0000ff', fg='#00ffff')]