コード例 #1
0
 def test_end_safely_before_html(self):
     """End before HTML when desired fragment size would truncate."""
     end = highlighting._end_safely(
         self.value, 215, start_tag=self.start_tag, end_tag=self.end_tag
     )
     # print(self.value[:end])
     self.assertEqual(end, 213, "Should end before the start of the tag.")
コード例 #2
0
 def test_end_safely_after_html_with_tolerance(self):
     """End before HTML when desired fragment size would truncate."""
     end = highlighting._end_safely(self.value,
                                    275,
                                    start_tag=self.start_tag,
                                    end_tag=self.end_tag)
     self.assertEqual(end, 275, "Should end after the closing tag.")
コード例 #3
0
 def test_end_safely_before_texism(self):
     """End before TeXism when desired fragment size would truncate."""
     end = highlighting._end_safely(
         self.value, 55, start_tag=self.start_tag, end_tag=self.end_tag
     )
     # print(self.value[:end])
     self.assertEqual(end, 50, "Should end before the start of the TeXism.")
コード例 #4
0
 def test_end_safely_from_start(self):
     """No TeXisms/HTML are found within the desired fragment size."""
     end = highlighting._end_safely(self.value,
                                    45,
                                    start_tag=self.start_tag,
                                    end_tag=self.end_tag)
     self.assertEqual(end, 45, "Should end at the desired fragment length.")