From 1afe429034e426bebbe41f7a5d708567eaf0c4e7 Mon Sep 17 00:00:00 2001 From: Vinayak Mehta Date: Sun, 11 Jul 2021 23:12:20 +0530 Subject: [PATCH] Change get backend method for Lattice and run tests --- camelot/parsers/lattice.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/camelot/parsers/lattice.py b/camelot/parsers/lattice.py index c897d69..a175227 100644 --- a/camelot/parsers/lattice.py +++ b/camelot/parsers/lattice.py @@ -140,19 +140,19 @@ class Lattice(BaseParser): return "convert" in methods if isinstance(backend, str): - if backend in BACKENDS.keys(): - if backend == "ghostscript": - warnings.warn( - "'ghostscript' will be replaced by 'poppler' as the default image conversion" - " backend in v0.12.0. You can try out 'poppler' with backend='poppler'.", - DeprecationWarning, - ) - - return BACKENDS[backend]() - else: + if backend not in BACKENDS.keys(): raise NotImplementedError( f"Unknown backend '{backend}' specified. Please use either 'poppler' or 'ghostscript'." ) + + if backend == "ghostscript": + warnings.warn( + "'ghostscript' will be replaced by 'poppler' as the default image conversion" + " backend in v0.12.0. You can try out 'poppler' with backend='poppler'.", + DeprecationWarning, + ) + + return BACKENDS[backend]() else: if not implements_convert(): raise NotImplementedError(