From 063e2edd75f71e373c4e89be077ee42e486108ab Mon Sep 17 00:00:00 2001 From: Jeremy Singer-Vine Date: Tue, 31 May 2022 15:45:40 -0400 Subject: [PATCH] Fix #659 (PageImage.debug_tablefinder()) Thanks to @rneumann7 for flagging! --- CHANGELOG.md | 6 ++++++ pdfplumber/display.py | 2 +- tests/test_display.py | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8687e76..7b59efb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/). +## [0.7.1] - 2022-05-31 + +### Fixed + +- Fix bug when calling `PageImage.debug_tablefinder()` (i.e., with no parameters). ([#659](https://github.com/jsvine/pdfplumber/issues/659)) [h/t @rneumann7] + ## [0.7.0] - 2022-05-27 ### Added diff --git a/pdfplumber/display.py b/pdfplumber/display.py index 91c3a24..9f56b5e 100644 --- a/pdfplumber/display.py +++ b/pdfplumber/display.py @@ -282,7 +282,7 @@ class PageImage: ) -> "PageImage": if isinstance(tf, TableFinder): finder = tf - elif isinstance(tf, (TableSettings, dict)): + elif tf is None or isinstance(tf, (TableSettings, dict)): finder = self.page.debug_tablefinder(tf) else: raise ValueError( diff --git a/tests/test_display.py b/tests/test_display.py index 22eefaf..0ad2d7c 100644 --- a/tests/test_display.py +++ b/tests/test_display.py @@ -40,6 +40,8 @@ class Test(unittest.TestCase): finder = TableFinder(self.im.page, settings) self.im.debug_tablefinder(finder) + self.im.debug_tablefinder(None) + with pytest.raises(ValueError): self.im.debug_tablefinder(0)