Skip to content

Commit

Permalink
Fix #1237 (tf → table_settings) h/t @n-traore
Browse files Browse the repository at this point in the history
And thanks to @cmdlineluser for the nudge.
  • Loading branch information
jsvine committed Dec 31, 2024
1 parent 6e54799 commit 078df97
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pdfplumber/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,17 @@ def debug_table(
return self

def debug_tablefinder(
self, tf: Optional[Union[TableFinder, TableSettings, T_table_settings]] = None
self,
table_settings: Optional[
Union[TableFinder, TableSettings, T_table_settings]
] = None,
) -> "PageImage":
if isinstance(tf, TableFinder):
finder = tf
elif tf is None or isinstance(tf, (TableSettings, dict)):
finder = self.page.debug_tablefinder(tf)
if isinstance(table_settings, TableFinder):
finder = table_settings
elif table_settings is None or isinstance(
table_settings, (TableSettings, dict)
):
finder = self.page.debug_tablefinder(table_settings)
else:
raise ValueError(
"Argument must be instance of TableFinder"
Expand Down
3 changes: 3 additions & 0 deletions tests/test_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def test_debug_tablefinder(self):

self.im.debug_tablefinder(None)

# https://github.com/jsvine/pdfplumber/issues/1237
self.im.debug_tablefinder(table_settings={})

with pytest.raises(ValueError):
self.im.debug_tablefinder(0)

Expand Down

0 comments on commit 078df97

Please sign in to comment.