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
def test(style, attr, before, after): s = TokenStyleEditor() assert getattr(s, attr) == before s.apply(style) assert getattr(s, attr) == after