Fix: Update parser contract to require empty strings, not None (#12775)

Co-authored-by: stumpylog <797416+stumpylog@users.noreply.github.com>
This commit is contained in:
shamoonandstumpylog authored and GitHub committed 2026-05-11 09:16:21 -07:00
1 parent 1527c347e3
commit 7471fedb43
10 files changed
+45 -39

No files matched your search

@@ -319,11 +319,11 @@ class TestRemoteParserParse:
assert remote_parser.get_text() == ""
assert remote_parser.get_archive_path() is None
def test_get_text_none_before_parse(
def test_get_text_empty_before_parse(
self,
remote_parser: RemoteDocumentParser,
) -> None:
assert remote_parser.get_text() is None
assert remote_parser.get_text() == ""
def test_get_date_always_none(
self,
@@ -342,7 +342,7 @@ class TestRemoteParserParse:
class TestRemoteParserParseError:
def test_parse_returns_none_on_azure_error(
def test_parse_returns_empty_on_azure_error(
self,
remote_parser: RemoteDocumentParser,
simple_digital_pdf_file: Path,
@@ -350,7 +350,7 @@ class TestRemoteParserParseError:
) -> None:
remote_parser.parse(simple_digital_pdf_file, "application/pdf")
assert remote_parser.get_text() is None
assert remote_parser.get_text() == ""
def test_parse_closes_client_on_error(
self,
@@ -138,11 +138,11 @@ class TestTextParserParse:
assert text_parser.get_text() == "Pantothens\ufffdure\n"
def test_get_text_none_before_parse(
def test_get_text_empty_before_parse(
self,
text_parser: TextDocumentParser,
) -> None:
assert text_parser.get_text() is None
assert text_parser.get_text() == ""
class TestTextParserThumbnail:
+2 -2
View File
@@ -74,8 +74,8 @@ def dummy_parser_cls() -> type:
Required to exist, but doesn't need to do anything
"""
def get_text(self) -> str | None:
return None
def get_text(self) -> str:
return ""
def get_date(self) -> None:
return None