Skip to content

Commit

Permalink
fixed text definition for non-silent fails
Browse files Browse the repository at this point in the history
  • Loading branch information
emcf committed Apr 16, 2024
1 parent 53a28eb commit 37251dc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tests/test_thepipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,19 @@ def test_create_messages_from_chunks(self):

def test_extract_from_source(self):
# test extracting examples for all supported file type
chunks = extractor.extract_from_source(source=self.files_directory)
chunks = extractor.extract_from_source(source=self.files_directory, ignore="unknown")
self.assertEqual(type(chunks), list)
for chunk in chunks:
self.assertEqual(type(chunk), core.Chunk)
self.assertIsNotNone(chunk.path)
self.assertIsNotNone(chunk.text or chunk.image)
# ensure unknown sources still acknowledges the existence of the source
chunks = extractor.extract_from_source(source='none')
self.assertEqual(type(chunks), list)
self.assertEqual(len(chunks), 1)
# ensure a chunk is still created to acknowledge the existence of an unknown source
chunks = extractor.extract_from_source(source=self.files_directory+"/example.unknown")
self.assertEqual(type(chunks), list)
self.assertEqual(len(chunks), 1)
# ensure unknown sources fail (test has "unknown in filename)
with self.assertRaises(Exception):
chunks = extractor.extract_from_source(source=self.files_directory+"/example.unknown")

def test_extract_from_source_text_only(self):
# test extracting examples for all supported file type
chunks = extractor.extract_from_source(source=self.files_directory, text_only=True)
chunks = extractor.extract_from_source(source=self.files_directory, text_only=True, ignore="unknown")
self.assertEqual(type(chunks), list)
# ensure no images are extracted
for chunk in chunks:
Expand Down

0 comments on commit 37251dc

Please sign in to comment.