def test(alignment, expected): commands = list(render(""" <document> <line> <span align="%s" width="5">aa</span> </line> </document>""" % alignment, prelude=False)) self.assertEqual(commands, expected)
def test(alignment, expected): commands = list( render(""" <document> <line> <span align="%s" width="5">aa</span> </line> </document>""" % alignment, prelude=False)) self.assertEqual(commands, expected)
def test_render_span(self): commands = list( render(""" <document> <line> <span>Hello world</span> </line> </document> """, prelude=False)) self.assertEqual(commands, [ ('write', "Hello world"), ('newline'), ])
def test_render_span(self): commands = list(render(""" <document> <line> <span>Hello world</span> </line> </document> """, prelude=False)) self.assertEqual( commands, [ ('write', "Hello world"), ('newline'), ] )
def test_highlight(self): commands = list( render(""" <document> <line> <highlight>BOLD</highlight> </line> </document> """, prelude=False)) self.assertEqual(commands, [ ('select-highlight'), ('write', "BOLD"), ('cancel-highlight'), ('newline'), ])
def test_bold(self): commands = list( render(""" <document> <line> <bold>BOLD</bold> </line> </document> """, prelude=False)) self.assertEqual(commands, [ ('select-bold'), ('write', "BOLD"), ('cancel-bold'), ('newline'), ])
def test_highlight(self): commands = list(render(""" <document> <line> <highlight>BOLD</highlight> </line> </document> """, prelude=False)) self.assertEqual( commands, [ ('select-highlight'), ('write', "BOLD"), ('cancel-highlight'), ('newline'), ] )
def test_bold(self): commands = list(render(""" <document> <line> <bold>BOLD</bold> </line> </document> """, prelude=False)) self.assertEqual( commands, [ ('select-bold'), ('write', "BOLD"), ('cancel-bold'), ('newline'), ] )
def test_stretch(self): commands = list( render(""" <document> <line> <span width="12"> <span align="left">left</span><span align="right">right</span> </span> </line> </document> """, prelude=False)) self.assertEqual(commands, [ ('write', "left"), ('write', " "), ('write', "right"), ('newline'), ])
def test_stretch(self): commands = list(render(""" <document> <line> <span width="12"> <span align="left">left</span><span align="right">right</span> </span> </line> </document> """, prelude=False)) self.assertEqual( commands, [ ('write', "left"), ('write', " "), ('write', "right"), ('newline'), ] )