Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayak-mehta committed Dec 26, 2024
1 parent 86a78eb commit 3d8e222
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion camelot/backends/ghostscript_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def convert(self, pdf_path: str, png_path: str, resolution: int = 300) -> None:
except ModuleNotFoundError as ex:
raise OSError(
"Ghostscript is not installed. You can install it using the instructions"
" here: https://pypdf-table-extraction.readthedocs.io/en/latest/user/install-deps.html"
" here: https://camelot-py.readthedocs.io/en/latest/user/install-deps.html"
) from ex

gs_command = [
Expand Down
18 changes: 8 additions & 10 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

import camelot
from camelot.backends.ghostscript_backend import GhostscriptBackend
from camelot.core import Table
from camelot.core import TableList
from camelot.core import Table, TableList
from camelot.io import PDFHandler

from .conftest import skip_on_windows
from .conftest import skip_pdftopng
from .conftest import skip_on_windows, skip_pdftopng
from .data import *


Expand Down Expand Up @@ -84,7 +82,7 @@ def test_url_pdfium():

@skip_pdftopng
def test_url_poppler():
url = "https://pypdf-table-extraction.readthedocs.io/en/latest/_static/pdf/foo.pdf"
url = "https://camelot-py.readthedocs.io/en/latest/_static/pdf/foo.pdf"
tables = camelot.read_pdf(url, backend="poppler")
assert repr(tables) == "<TableList n=1>"
assert repr(tables[0]) == "<Table shape=(7, 7)>"
Expand All @@ -93,7 +91,7 @@ def test_url_poppler():

@skip_on_windows
def test_url_ghostscript(testdir):
url = "https://pypdf-table-extraction.readthedocs.io/en/latest/_static/pdf/foo.pdf"
url = "https://camelot-py.readthedocs.io/en/latest/_static/pdf/foo.pdf"
tables = camelot.read_pdf(url, backend="ghostscript")
assert repr(tables) == "<TableList n=1>"
assert repr(tables[0]) == "<Table shape=(7, 7)>"
Expand All @@ -102,7 +100,7 @@ def test_url_ghostscript(testdir):

@skip_on_windows
def test_url_ghostscript_custom_backend(testdir):
url = "https://pypdf-table-extraction.readthedocs.io/en/latest/_static/pdf/foo.pdf"
url = "https://camelot-py.readthedocs.io/en/latest/_static/pdf/foo.pdf"
tables = camelot.read_pdf(url, backend=GhostscriptBackend())
assert repr(tables) == "<TableList n=1>"
assert repr(tables[0]) == "<Table shape=(7, 7)>"
Expand All @@ -129,7 +127,7 @@ def test_pages_pdfium():

@skip_pdftopng
def test_pages_poppler():
url = "https://pypdf-table-extraction.readthedocs.io/en/latest/_static/pdf/foo.pdf"
url = "https://camelot-py.readthedocs.io/en/latest/_static/pdf/foo.pdf"
tables = camelot.read_pdf(url, backend="poppler", use_fallback=False)
assert repr(tables) == "<TableList n=1>"
assert repr(tables[0]) == "<Table shape=(7, 7)>"
Expand All @@ -148,7 +146,7 @@ def test_pages_poppler():

@skip_on_windows
def test_pages_ghostscript():
url = "https://pypdf-table-extraction.readthedocs.io/en/latest/_static/pdf/foo.pdf"
url = "https://camelot-py.readthedocs.io/en/latest/_static/pdf/foo.pdf"
tables = camelot.read_pdf(url, backend="ghostscript", use_fallback=False)
assert repr(tables) == "<TableList n=1>"
assert repr(tables[0]) == "<Table shape=(7, 7)>"
Expand All @@ -171,7 +169,7 @@ def test_pages_ghostscript():

@skip_on_windows
def test_pages_ghostscript_custom_backend():
url = "https://pypdf-table-extraction.readthedocs.io/en/latest/_static/pdf/foo.pdf"
url = "https://camelot-py.readthedocs.io/en/latest/_static/pdf/foo.pdf"
custom_backend = GhostscriptBackend()
tables = camelot.read_pdf(url, backend=custom_backend, use_fallback=False)
assert repr(tables) == "<TableList n=1>"
Expand Down

0 comments on commit 3d8e222

Please sign in to comment.