Exemple #1
0
 def test_txt_extraction_with_bad_data(self):
     """Can we extract text from nasty files lacking encodings?"""
     path = os.path.join(settings.MEDIA_ROOT, 'test', 'search',
                         'txt_file_with_no_encoding.txt')
     content, err = extract_from_txt(path)
     self.assertFalse(err, "Error reported while extracting text from %s" %
                      path)
     self.assertIn(u'¶  1.  DOOLEY, J.   Plaintiffs', content,
                   "Issue extracting/encoding text from file at: %s" % path)
Exemple #2
0
    def test_txt_extraction_with_bad_data(self) -> None:
        """Can we extract text from nasty files lacking encodings?"""

        path = os.path.join(
            settings.MEDIA_ROOT,
            "test",
            "search",
            "txt_file_with_no_encoding.txt",
        )
        content, err = extract_from_txt(path)
        self.assertFalse(err,
                         f"Error reported while extracting text from {path}")
        self.assertIn(
            "¶  1.  DOOLEY, J.   Plaintiffs",
            content,
            f"Issue extracting/encoding text from file at: {path}",
        )