From 1dc8f4e2418897abb5008aea46603127d5d01126 Mon Sep 17 00:00:00 2001 From: Vinayak Mehta Date: Tue, 6 Jul 2021 02:58:41 +0530 Subject: [PATCH] Use PopplerBackend and GhostscriptBackend in test_plotting.py --- tests/test_plotting.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/test_plotting.py b/tests/test_plotting.py index 5be7a48..22d9f6f 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -6,7 +6,8 @@ import sys import pytest import camelot -from camelot.backends.image_conversion import ImageConversionBackend +from camelot.backends.poppler_backend import PopplerBackend +from camelot.backends.ghostscript_backend import GhostscriptBackend testdir = os.path.dirname(os.path.abspath(__file__)) @@ -30,7 +31,7 @@ def test_textedge_plot(): @pytest.mark.mpl_image_compare(baseline_dir="files/baseline_plots", remove_text=True) def test_lattice_contour_plot_poppler(): filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("poppler", use_fallback=False)) + tables = camelot.read_pdf(filename, backend=PopplerBackend()) return camelot.plot(tables[0], kind="contour") @@ -40,7 +41,7 @@ def test_lattice_contour_plot_ghostscript(): pytest.skip("Skipping ghostscript test on Windows") filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript", use_fallback=False)) + tables = camelot.read_pdf(filename, backend=GhostscriptBackend()) return camelot.plot(tables[0], kind="contour") @@ -54,7 +55,7 @@ def test_stream_contour_plot(): @pytest.mark.mpl_image_compare(baseline_dir="files/baseline_plots", remove_text=True) def test_line_plot_poppler(): filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("poppler", use_fallback=False)) + tables = camelot.read_pdf(filename, backend=PopplerBackend()) return camelot.plot(tables[0], kind="line") @@ -64,14 +65,14 @@ def test_line_plot_ghostscript(): pytest.skip("Skipping ghostscript test on Windows") filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript", use_fallback=False)) + tables = camelot.read_pdf(filename, backend=GhostscriptBackend()) return camelot.plot(tables[0], kind="line") @pytest.mark.mpl_image_compare(baseline_dir="files/baseline_plots", remove_text=True) def test_joint_plot_poppler(): filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("poppler", use_fallback=False)) + tables = camelot.read_pdf(filename, backend=PopplerBackend()) return camelot.plot(tables[0], kind="joint") @@ -81,14 +82,14 @@ def test_joint_plot_ghostscript(): pytest.skip("Skipping ghostscript test on Windows") filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript", use_fallback=False)) + tables = camelot.read_pdf(filename, backend=GhostscriptBackend()) return camelot.plot(tables[0], kind="joint") @pytest.mark.mpl_image_compare(baseline_dir="files/baseline_plots", remove_text=True) def test_grid_plot_poppler(): filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("poppler", use_fallback=False)) + tables = camelot.read_pdf(filename, backend=PopplerBackend()) return camelot.plot(tables[0], kind="grid") @@ -98,5 +99,5 @@ def test_grid_plot_ghostscript(): pytest.skip("Skipping ghostscript test on Windows") filename = os.path.join(testdir, "foo.pdf") - tables = camelot.read_pdf(filename, backend=ImageConversionBackend("ghostscript", use_fallback=False)) + tables = camelot.read_pdf(filename, backend=GhostscriptBackend()) return camelot.plot(tables[0], kind="grid")