Add test
parent
9d90cadac0
commit
605ffdd444
|
|
@ -357,8 +357,8 @@ class Lattice(BaseParser):
|
|||
|
||||
if not self.horizontal_text:
|
||||
if self.images:
|
||||
warnings.warn('The page is image-based, Camelot only works with'
|
||||
' text-based PDF pages.'.format(os.path.basename(self.rootname)))
|
||||
warnings.warn('{} is image-based, camelot only works on'
|
||||
' text-based pages.'.format(os.path.basename(self.rootname)))
|
||||
else:
|
||||
warnings.warn('No tables found on {}'.format(
|
||||
os.path.basename(self.rootname)))
|
||||
|
|
|
|||
|
|
@ -396,8 +396,8 @@ class Stream(BaseParser):
|
|||
|
||||
if not self.horizontal_text:
|
||||
if self.images:
|
||||
warnings.warn('The page is image-based, Camelot only works with'
|
||||
' text-based PDF pages.'.format(os.path.basename(self.rootname)))
|
||||
warnings.warn('{} is image-based, camelot only works on'
|
||||
' text-based pages.'.format(os.path.basename(self.rootname)))
|
||||
else:
|
||||
warnings.warn('No tables found on {}'.format(
|
||||
os.path.basename(self.rootname)))
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -41,6 +41,15 @@ def test_stream_equal_length():
|
|||
table_areas=['10,20,30,40'], columns=['10,20,30,40', '10,20,30,40'])
|
||||
|
||||
|
||||
def test_image_warning():
|
||||
filename = os.path.join(testdir, 'image.pdf')
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter('error')
|
||||
with pytest.raises(UserWarning) as e:
|
||||
tables = camelot.read_pdf(filename)
|
||||
assert str(e.value) == 'page-1 is image-based, camelot only works on text-based pages.'
|
||||
|
||||
|
||||
def test_no_tables_found():
|
||||
filename = os.path.join(testdir, 'blank.pdf')
|
||||
with warnings.catch_warnings():
|
||||
|
|
|
|||
Loading…
Reference in New Issue