Example #1
0
 def test_corrupted_ocr(self):
     fs = FilesystemSource(os.path.join(test_data_path, "corrupted"))
     with SourceManager() as sm:
         for h in fs.handles(sm):
             resource = h.follow(sm)
             self.assertEqual(convert(resource, OutputType.Text), None,
                              "{0}: error handling failed".format(h))
Example #2
0
 def test_ocr_conversions(self):
     fs = FilesystemSource(os.path.join(test_data_path, "good"))
     with SourceManager() as sm:
         for h in fs.handles(sm):
             resource = h.follow(sm)
             self.assertEqual(
                 convert(resource, OutputType.Text).value, expected_result,
                 "{0}: content failed".format(h))
Example #3
0
 def test_size_computation(self):
     fs = FilesystemSource(test_data_path)
     with SourceManager() as sm:
         for h in fs.handles(sm):
             resource = h.follow(sm)
             size = convert(resource, OutputType.ImageDimensions)
             if not size:
                 if "rgba32" in h.relative_path:
                     self.skipTest("Pillow RGBA bug detected -- skipping")
             else:
                 size = size.value
             self.assertEqual(size, expected_size, "{0}: size failed")
Example #4
0
 def test_eml_files(self):
     fs = FilesystemSource(test_data_path)
     with SourceManager() as sm:
         for h in fs.handles(sm):
             mail_source = Source.from_handle(h)
             self.assertIsInstance(
                     mail_source,
                     MailSource,
                     "conversion of {0} to MailSource failed".format(h))
             for h in mail_source.handles(sm):
                 self.assertIsInstance(
                         h,
                         MailPartHandle)