Example #1
0
 def test_long_string_non_ascii(self):
     self.assertEqual(
         StringValue('line1\n'
                     'line2\n'
                     'line3 \xff\n'
                     'line4\n'
                     'line5\n').render(),
         '\'<span class="struct">line1<br />'
         'line2<br />'
         'line3 \\xff<br />'
         'line4<br />'
         'line5\'</span>')
Example #2
0
 def test_long_string_unicode(self):
     self.assertEqual(
         StringValue(u'line1\n'
                     u'line2\n'
                     u'line3 \xff\n'
                     u'line4\n'
                     u'line5\n').render(),
         self.u + u'\'<span class="struct">line1<br />'
         u'line2<br />'
         u'line3 \xff<br />'
         u'line4<br />'
         u'line5\'</span>')
Example #3
0
 def test_long_string(self):
     self.assertEqual(
         StringValue('line1 <\n'
                     'line2 &\n'
                     'line3\n'
                     'line4\n'
                     'line5\n').render(),
         '\'<span class="struct">line1 &lt;<br />'
         'line2 &amp;<br />'
         'line3<br />'
         'line4<br />'
         'line5\'</span>')
Example #4
0
 def test_long_string_indentation(self):
     self.assertEqual(
         StringValue('line1\n'
                     ' line2\n'
                     '  line3\n'
                     '\tline4\n'
                     'line5\n').render(),
         '\'<span class="struct">line1<br />'
         '&nbsp;line2<br />'
         '&nbsp;&nbsp;line3<br />'
         '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line4<br />'
         'line5\'</span>')
Example #5
0
 def test_long_string_truncation(self):
     self.assertEqual(
         StringValue('line1\n'
                     'line2\n'
                     'line3\n'
                     'line4\n'
                     'line5\n'
                     'line6\n'
                     'line7').render(limit=10),
         '\'<span class="struct">line1<br />'
         'line2<br />'
         'line3<br />'
         'line4<br />'
         'line5<br />'
         '<span id="tr1" class="truncated">...</span>\'</span>')
     self.assertEqual(TRUNCATIONS['tr1'], "line6<br />line7")
Example #6
0
 def test_short_string_unicode(self):
     self.assertEqual(StringValue(u'\u1234').render(), self.u + "'\u1234'")
Example #7
0
 def test_short_string_truncation(self):
     self.assertEqual(
         StringValue('a very long string').render(limit=10),
         """'a very lo<span id="tr1" class="truncated">...</span>""")
     self.assertEqual(TRUNCATIONS['tr1'], "ng string'")
     self.assertEqual(list(TRUNCATIONS_IN_ORDER), ['tr1'])
Example #8
0
 def test_short_string_control_char(self):
     self.assertEqual(StringValue('\x17').render(), """'\\x17'""")
Example #9
0
 def test_short_string_escaping(self):
     self.assertEqual(
         StringValue('x"y\'z\\z<y&').render(),
         """'x"y\\'z\\\\z&lt;y&amp;'""")
Example #10
0
 def test_short_string(self):
     self.assertEqual(StringValue('xyzzy').render(), "'xyzzy'")
Example #11
0
 def test_empty_string(self):
     self.assertEqual(StringValue('').render(), "''")
Example #12
0
 def test_interface_compliance(self):
     verifyObject(IValueRenderer, StringValue(()))