Add test
parent
b2a8348f13
commit
de3281c1b6
|
|
@ -287,6 +287,10 @@ class Stream(BaseParser):
|
||||||
hor_text = []
|
hor_text = []
|
||||||
for region in self.table_regions:
|
for region in self.table_regions:
|
||||||
x1, y1, x2, y2 = region.split(",")
|
x1, y1, x2, y2 = region.split(",")
|
||||||
|
x1 = float(x1)
|
||||||
|
y1 = float(y1)
|
||||||
|
x2 = float(x2)
|
||||||
|
y2 = float(y2)
|
||||||
region_text = text_in_bbox((x1, y2, x2, y1), self.horizontal_text)
|
region_text = text_in_bbox((x1, y2, x2, y1), self.horizontal_text)
|
||||||
hor_text.extend(region_text)
|
hor_text.extend(region_text)
|
||||||
# find tables based on nurminen's detection algorithm
|
# find tables based on nurminen's detection algorithm
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,14 @@ def test_stream_two_tables():
|
||||||
assert df2.equals(tables[1].df)
|
assert df2.equals(tables[1].df)
|
||||||
|
|
||||||
|
|
||||||
|
def test_stream_table_regions():
|
||||||
|
df = pd.DataFrame(data_stream_table_areas)
|
||||||
|
|
||||||
|
filename = os.path.join(testdir, "tabula/us-007.pdf")
|
||||||
|
tables = camelot.read_pdf(filename, flavor="stream", table_areas=["320,460,573,335"])
|
||||||
|
assert df.equals(tables[0].df)
|
||||||
|
|
||||||
|
|
||||||
def test_stream_table_areas():
|
def test_stream_table_areas():
|
||||||
df = pd.DataFrame(data_stream_table_areas)
|
df = pd.DataFrame(data_stream_table_areas)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue