Beispiel #1
0
def _read_style_section(section):
    """Convert *section* to a Pygments-compatible style string.
    """
    ts = TokenStyleEditor()
    ts.inherit = section.getboolean('inherit', True)
    ts.bold = section.getboolean('bold', None)
    ts.italic = section.getboolean('italic', None)
    ts.underline = section.getboolean('underline', None)
    ts.color = section.get('color', None)
    ts.bgcolor = section.get('bgcolor', None)
    ts.border = section.get('border', None)
    return ts
Beispiel #2
0
def test_tokenstyle_equality():
    s1 = TokenStyleEditor()
    # Equal to itself
    assert s1 == s1
    s2 = TokenStyleEditor()
    # Equal to another empty style
    assert s1 == s2
    s1.apply("bold noitalic #fff bg:#000")
    # Not equal to different style
    assert s1 != s2
    s2.bold = True
    s2.italic = False
    s2.color = '#ffffff'
    s2.bgcolor = '#000'
    # The styles should be equal again
    assert s1 == s2
Beispiel #3
0
 def test(value):
     s = TokenStyleEditor()
     s.color = value
Beispiel #4
0
 def test(value, postcond):
     s = TokenStyleEditor("#000000")
     assert s.color != postcond, 'postcondition true before test'
     s.color = value
     eq_(s.color, postcond)