From 78882a8583f42cedf7abde350bfdfa77d2131906 Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 3 Jun 2024 16:41:54 +0100 Subject: [PATCH 1/2] Updating the conditional of whether to assign a page number. --- src/cpr_sdk/parser_models.py | 4 ++-- tests/test_parser_models.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cpr_sdk/parser_models.py b/src/cpr_sdk/parser_models.py index 25e6d5f..9f48c3f 100644 --- a/src/cpr_sdk/parser_models.py +++ b/src/cpr_sdk/parser_models.py @@ -415,10 +415,10 @@ def to_passage_level_json(self) -> list[dict[str, Any]]: ] for passage in passages_array: - page_number = passage.get("page_number") + page_number = passage.get("page_number", None) passage[PDF_PAGE_METADATA_KEY] = ( self.get_page_metadata_by_page_number(page_number) - if page_number + if page_number is not None else None ) diff --git a/tests/test_parser_models.py b/tests/test_parser_models.py index 9e35432..0fbc148 100644 --- a/tests/test_parser_models.py +++ b/tests/test_parser_models.py @@ -204,6 +204,7 @@ def test_to_passage_level_json_method( ) if passage["document_content_type"] == CONTENT_TYPE_PDF: + assert passage[PDF_PAGE_METADATA_KEY] is not None assert set(passage["pdf_data"].keys()) == expected_pdf_data_fields elif passage["document_content_type"] == CONTENT_TYPE_HTML: assert set(passage["html_data"].keys()) == expected_html_data_fields From 772b9af2187142ca448af817d41dc93256a06ccd Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 3 Jun 2024 16:45:38 +0100 Subject: [PATCH 2/2] Bump the version of the package - patch. --- src/cpr_sdk/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpr_sdk/version.py b/src/cpr_sdk/version.py index 2fb9885..bc6a02f 100644 --- a/src/cpr_sdk/version.py +++ b/src/cpr_sdk/version.py @@ -1,6 +1,6 @@ _MAJOR = "1" _MINOR = "1" -_PATCH = "4" +_PATCH = "5" _SUFFIX = "" VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR)