示例#1
0
 def test_html_compatibility_mode_no_xhtml(self):
     """ Test if the HTML retro-compatibility mode work as expected (without allowing XHTML-like tags). """
     with self.assertRaises(ValueError):
         parse_tag('[tagname/]', 0, opening_tag_ch='[', closing_tag_ch=']', allow_self_closing_tags=False)
示例#2
0
 def test_error(self):
     """ Error handling tests. """
     for text, excepted_exception in self.FAIL_TESTS:
         with self.assertRaises(excepted_exception, msg=text):
             parse_tag(text, 0, opening_tag_ch='[', closing_tag_ch=']')
示例#3
0
 def test_html_compatibility_mode(self):
     """ Test if the HTML retro-compatibility mode work as expected. """
     with self.assertRaises(ValueError):
         parse_tag('[tagname=tagvalue]', 0, opening_tag_ch='[', closing_tag_ch=']', allow_tagvalue_attr=False)
示例#4
0
 def test_functional(self):
     """ Functional tests. """
     for text, excepted_result in self.PASS_TESTS:
         result = parse_tag(text, 0, opening_tag_ch='[', closing_tag_ch=']')
         self.assertEqual(result, excepted_result, msg=text)
示例#5
0
 def test_html_compatibility_mode_no_xhtml(self):
     """ Test if the HTML retro-compatibility mode work as expected (without allowing XHTML-like tags). """
     with self.assertRaises(ValueError):
         parse_tag('[tagname/]', 0, opening_tag_ch='[', closing_tag_ch=']', allow_self_closing_tags=False)
示例#6
0
 def test_html_compatibility_mode(self):
     """ Test if the HTML retro-compatibility mode work as expected. """
     with self.assertRaises(ValueError):
         parse_tag('[tagname=tagvalue]', 0, opening_tag_ch='[', closing_tag_ch=']', allow_tagvalue_attr=False)
示例#7
0
 def test_error(self):
     """ Error handling tests. """
     for text, excepted_exception in self.FAIL_TESTS:
         with self.assertRaises(excepted_exception, msg=text):
             parse_tag(text, 0, opening_tag_ch='[', closing_tag_ch=']')
示例#8
0
 def test_functional(self):
     """ Functional tests. """
     for text, excepted_result in self.PASS_TESTS:
         result = parse_tag(text, 0, opening_tag_ch='[', closing_tag_ch=']')
         self.assertEqual(result, excepted_result, msg=text)