Add pages test
parent
ea5747c5c4
commit
859610e0dc
|
|
@ -22,7 +22,7 @@ class PDFHandler(object):
|
||||||
Filepath or URL of the PDF file.
|
Filepath or URL of the PDF file.
|
||||||
pages : str, optional (default: '1')
|
pages : str, optional (default: '1')
|
||||||
Comma-separated page numbers.
|
Comma-separated page numbers.
|
||||||
Example: '1,3,4' or '1,4-end'.
|
Example: '1,3,4' or '1,4-end' or 'all'.
|
||||||
password : str, optional (default: None)
|
password : str, optional (default: None)
|
||||||
Password for decryption.
|
Password for decryption.
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ class PDFHandler(object):
|
||||||
Filepath or URL of the PDF file.
|
Filepath or URL of the PDF file.
|
||||||
pages : str, optional (default: '1')
|
pages : str, optional (default: '1')
|
||||||
Comma-separated page numbers.
|
Comma-separated page numbers.
|
||||||
Example: 1,3,4 or 1,4-end.
|
Example: '1,3,4' or '1,4-end' or 'all'.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from .handlers import PDFHandler
|
from .handlers import PDFHandler
|
||||||
|
|
@ -18,7 +19,7 @@ def read_pdf(filepath, pages='1', password=None, flavor='lattice',
|
||||||
Filepath or URL of the PDF file.
|
Filepath or URL of the PDF file.
|
||||||
pages : str, optional (default: '1')
|
pages : str, optional (default: '1')
|
||||||
Comma-separated page numbers.
|
Comma-separated page numbers.
|
||||||
Example: '1,3,4' or '1,4-end'.
|
Example: '1,3,4' or '1,4-end' or 'all'.
|
||||||
password : str, optional (default: None)
|
password : str, optional (default: None)
|
||||||
Password for decryption.
|
Password for decryption.
|
||||||
flavor : str (default: 'lattice')
|
flavor : str (default: 'lattice')
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,24 @@ def test_repr():
|
||||||
assert repr(tables[0].cells[0][0]) == "<Cell x1=120.48 y1=218.43 x2=164.64 y2=233.77>"
|
assert repr(tables[0].cells[0][0]) == "<Cell x1=120.48 y1=218.43 x2=164.64 y2=233.77>"
|
||||||
|
|
||||||
|
|
||||||
|
def test_pages():
|
||||||
|
url = "https://camelot-py.readthedocs.io/en/master/_static/pdf/foo.pdf"
|
||||||
|
tables = camelot.read_pdf(url)
|
||||||
|
assert repr(tables) == "<TableList n=1>"
|
||||||
|
assert repr(tables[0]) == "<Table shape=(7, 7)>"
|
||||||
|
assert repr(tables[0].cells[0][0]) == "<Cell x1=120.48 y1=218.43 x2=164.64 y2=233.77>"
|
||||||
|
|
||||||
|
tables = camelot.read_pdf(url, pages='1-end')
|
||||||
|
assert repr(tables) == "<TableList n=1>"
|
||||||
|
assert repr(tables[0]) == "<Table shape=(7, 7)>"
|
||||||
|
assert repr(tables[0].cells[0][0]) == "<Cell x1=120.48 y1=218.43 x2=164.64 y2=233.77>"
|
||||||
|
|
||||||
|
tables = camelot.read_pdf(url, pages='all')
|
||||||
|
assert repr(tables) == "<TableList n=1>"
|
||||||
|
assert repr(tables[0]) == "<Table shape=(7, 7)>"
|
||||||
|
assert repr(tables[0].cells[0][0]) == "<Cell x1=120.48 y1=218.43 x2=164.64 y2=233.77>"
|
||||||
|
|
||||||
|
|
||||||
def test_url():
|
def test_url():
|
||||||
url = "https://camelot-py.readthedocs.io/en/master/_static/pdf/foo.pdf"
|
url = "https://camelot-py.readthedocs.io/en/master/_static/pdf/foo.pdf"
|
||||||
tables = camelot.read_pdf(url)
|
tables = camelot.read_pdf(url)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue