@@ -155,3 +155,62 @@ def test_network_no_infinite_execution(testdir):
155155 )
156156
157157 assert len (tables ) >= 1
158+
159+
160+ # Reported as https://github.com/camelot-dev/camelot/issues/585
161+ def test_issue_585 (testdir ):
162+ """Test for GitHub issue #585.
163+
164+ This test checks that Camelot can successfully extract tables when using
165+ the 'network' flavor with specified 'table_areas' and 'columns',
166+ ensuring that at least one table is detected.
167+
168+ Parameters
169+ ----------
170+ testdir : str
171+ The path to the test directory.
172+
173+ """
174+ filename = os .path .join (testdir , "multiple_tables.pdf" )
175+ tables = camelot .read_pdf (
176+ filename ,
177+ flavor = "network" ,
178+ table_areas = ["100,700,500,100" ],
179+ columns = ["150,200,250,300,350,400,450,500" ],
180+ )
181+ assert len (tables ) > 0
182+
183+
184+ def test_issue_585_network_flavor_with_table_areas (testdir ):
185+ """Test for GitHub issue #585, focusing on the 'network' flavor.
186+
187+ This test verifies that Camelot's 'network' flavor can detect and
188+ extract a table when a specific 'table_areas' is provided. The issue
189+ reported that this scenario was failing, while the 'lattice' flavor
190+ worked. This test ensures the 'network' flavor now behaves as expected.
191+
192+ It checks that exactly one table is found in the specified area.
193+
194+ Parameters
195+ ----------
196+ testdir : str
197+ The path to the test directory, provided by the testing framework.
198+ This directory should contain the 'issue_585.pdf' file.
199+
200+ """
201+ # Use the PDF file mentioned in the GitHub issue
202+ filename = os .path .join (testdir , "good_energy.pdf" )
203+
204+ # The table_areas and columns are taken directly from the issue report
205+ # to replicate the exact conditions.
206+ tables = camelot .read_pdf (
207+ filename ,
208+ flavor = "network" ,
209+ table_areas = ["46,213,558,180" ],
210+ columns = ["92,159,262,357,454,534" ],
211+ split_text = True ,
212+ )
213+
214+ # The core of the issue was that no tables were being detected.
215+ # This assertion now checks that exactly one table is found.
216+ assert len (tables ) == 1
0 commit comments