Esempio n. 1
0
 def test_several_styles(self):
     rich = bold('outer') + (bold + italic)('inner') + bold('outer')
     write_text(self.out, rich, False)
     self.assertEqual(
         self.out.getvalue(), '      <Text Style="Bold">outer</Text>\n'
         '      <Text Style="Bold+Italic">inner</Text>\n'
         '      <Text Style="Bold">outer</Text>\n')
Esempio n. 2
0
 def test_sequential_styles(self):
     rich = plain('plain') + bold('b') + italic('i')
     write_text(self.out, rich, False)
     self.assertEqual(
         self.out.getvalue(), '      <Text>plain</Text>\n'
         '      <Text Style="Bold">b</Text>\n'
         '      <Text Style="Italic">i</Text>\n')
Esempio n. 3
0
 def test_write_text_adds_line_break_if_requested(self):
     rich = bold('outer') + (bold + italic)('inner') + bold('outer')
     write_text(self.out, rich, True)
     self.assertEqual(
         self.out.getvalue(),
         '      <Text Style="Bold">outer</Text>\n'
         '      <Text Style="Bold+Italic">inner</Text>\n'
         '      <Text Style="Bold">outer\n</Text>\n'  # note newline
     )
Esempio n. 4
0
 def test_several_styles(self):
     rich = bold('outer') + (bold + italic)('inner') + bold('outer')
     write_text(self.out, rich, False)
     self.assertEqual(
         self.out.getvalue(),
         '      <Text Style="Bold">outer</Text>\n'
         '      <Text Style="Bold+Italic">inner</Text>\n'
         '      <Text Style="Bold">outer</Text>\n'
     )
Esempio n. 5
0
 def test_sequential_styles(self):
     rich = plain('plain') + bold('b') + italic('i')
     write_text(self.out, rich, False)
     self.assertEqual(
         self.out.getvalue(),
         '      <Text>plain</Text>\n'
         '      <Text Style="Bold">b</Text>\n'
         '      <Text Style="Italic">i</Text>\n'
     )
Esempio n. 6
0
 def test_bold_text_should_have_bold_style(self):
     write_text(self.out, bold('hello'), False)
     self.assertEqual(
         self.out.getvalue(),
         '      <Text Style="Bold">hello</Text>\n'
     )
Esempio n. 7
0
 def test_plain_text_should_have_no_style(self):
     write_text(self.out, plain('hello'), False)
     self.assertEqual(
         self.out.getvalue(),
         '      <Text>hello</Text>\n'
     )