Split tests for lattice and stream, and fix test_common reprs
This commit is contained in:
@@ -23,7 +23,9 @@ class ImageConversionBackend(object):
|
||||
converter = backends[self.backend]()
|
||||
converter.convert(pdf_path, png_path)
|
||||
except Exception as e:
|
||||
logger.info(f"Image conversion backend '{self.backend}' failed with '{str(e)}'")
|
||||
logger.info(
|
||||
f"Image conversion backend '{self.backend}' failed with '{str(e)}'"
|
||||
)
|
||||
|
||||
if self.use_fallback:
|
||||
for fallback in self.fallbacks:
|
||||
@@ -33,7 +35,9 @@ class ImageConversionBackend(object):
|
||||
converter = backends[fallback]()
|
||||
converter.convert(pdf_path, png_path)
|
||||
except Exception as e:
|
||||
logger.info(f"Image conversion backend '{fallback}' failed with '{str(e)}'")
|
||||
logger.info(
|
||||
f"Image conversion backend '{fallback}' failed with '{str(e)}'"
|
||||
)
|
||||
continue
|
||||
else:
|
||||
logger.info(f"Image conversion backend '{fallback}' succeeded")
|
||||
|
||||
+4
-4
@@ -288,10 +288,10 @@ class Cell(object):
|
||||
self._text = ""
|
||||
|
||||
def __repr__(self):
|
||||
x1 = round(self.x1, 2)
|
||||
y1 = round(self.y1, 2)
|
||||
x2 = round(self.x2, 2)
|
||||
y2 = round(self.y2, 2)
|
||||
x1 = round(self.x1)
|
||||
y1 = round(self.y1)
|
||||
x2 = round(self.x2)
|
||||
y2 = round(self.y2)
|
||||
return f"<Cell x1={x1} y1={y1} x2={x2} y2={y2}>"
|
||||
|
||||
@property
|
||||
|
||||
@@ -112,6 +112,7 @@ class Lattice(BaseParser):
|
||||
threshold_constant=-2,
|
||||
iterations=0,
|
||||
resolution=300,
|
||||
backend=ImageConversionBackend(),
|
||||
**kwargs,
|
||||
):
|
||||
self.table_regions = table_regions
|
||||
@@ -129,7 +130,7 @@ class Lattice(BaseParser):
|
||||
self.threshold_constant = threshold_constant
|
||||
self.iterations = iterations
|
||||
self.resolution = resolution
|
||||
self.backend = ImageConversionBackend()
|
||||
self.backend = backend
|
||||
|
||||
@staticmethod
|
||||
def _reduce_index(t, idx, shift_text):
|
||||
|
||||
Reference in New Issue
Block a user