def test_illegal_chars_in_xml(self):
     for c in u'\x00\x08\x0B\x0C\x0E\x1F\uFFFE\uFFFF':
         assert_equals(attribute_escape(c), '')
 def test_html_entities(self):
     for inp, exp in [('"', '&quot;'), ('<', '&lt;'), ('>', '&gt;'),
                      ('&', '&amp;'), ('&<">&', '&amp;&lt;&quot;&gt;&amp;'),
                      ('Sanity < "check"', 'Sanity &lt; &quot;check&quot;')]:
         assert_equals(attribute_escape(inp), exp)
 def test_newlines_and_tabs(self):
     for inp, exp in [('\n', '&#10;'), ('\t', '&#09;'), ('"\n\t"', '&quot;&#10;&#09;&quot;'),
                      ('N1\nN2\n\nT1\tT3\t\t\t', 'N1&#10;N2&#10;&#10;T1&#09;T3&#09;&#09;&#09;')]:
         assert_equals(attribute_escape(inp), exp)
 def test_nothing_to_escape(self):
     for inp in ['', 'whatever', 'nothing here, move along']:
         assert_equals(attribute_escape(inp), inp)
Пример #5
0
 def test_illegal_chars_in_xml(self):
     for c in u'\x00\x08\x0B\x0C\x0E\x1F\uFFFE\uFFFF':
         assert_equal(attribute_escape(c), '')
Пример #6
0
 def test_newlines_and_tabs(self):
     for inp, exp in [('\n', '&#10;'), ('\t', '&#09;'),
                      ('"\n\t"', '&quot;&#10;&#09;&quot;'),
                      ('N1\nN2\n\nT1\tT3\t\t\t',
                       'N1&#10;N2&#10;&#10;T1&#09;T3&#09;&#09;&#09;')]:
         assert_equal(attribute_escape(inp), exp)
Пример #7
0
 def test_html_entities(self):
     for inp, exp in [('"', '&quot;'), ('<', '&lt;'), ('>', '&gt;'),
                      ('&', '&amp;'), ('&<">&', '&amp;&lt;&quot;&gt;&amp;'),
                      ('Sanity < "check"', 'Sanity &lt; &quot;check&quot;')
                      ]:
         assert_equal(attribute_escape(inp), exp)
Пример #8
0
 def test_nothing_to_escape(self):
     for inp in ['', 'whatever', 'nothing here, move along']:
         assert_equal(attribute_escape(inp), inp)