From bf71a0921b299d666323556074267f14f1f90322 Mon Sep 17 00:00:00 2001 From: OlteanuRares Date: Wed, 17 Jun 2026 13:09:09 +0300 Subject: [PATCH 1/2] OCTO-11477 --- pycaption/dfxp/base.py | 10 +++++++--- tests/conftest.py | 1 + tests/fixtures/dfxp.py | 28 +++++++++++++++++++++++++++ tests/test_dfxp.py | 44 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 79 insertions(+), 4 deletions(-) diff --git a/pycaption/dfxp/base.py b/pycaption/dfxp/base.py index b6facc97..f4376e3a 100644 --- a/pycaption/dfxp/base.py +++ b/pycaption/dfxp/base.py @@ -147,9 +147,13 @@ def _get_dfxp_parser_class(): def _convert_div_to_caption_list(self, div): return CaptionList( [ - self._convert_p_tag_to_caption(p_tag) - for p_tag in div.find_all("p") - if p_tag.get_text().strip() + caption + for caption in ( + self._convert_p_tag_to_caption(p_tag) + for p_tag in div.find_all("p") + if p_tag.get_text().strip() + ) + if caption is not None ], div.layout_info, ) diff --git a/tests/conftest.py b/tests/conftest.py index 6f4a007a..39bf9cd6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -45,6 +45,7 @@ sample_dfxp_with_relativized_positioning, sample_dfxp_with_templated_style, sample_dfxp_without_region_and_style, + sample_dfxp_concurrent_with_empty_p, ) from tests.fixtures.microdvd import missing_fps_sample_microdvd # noqa: F401 from tests.fixtures.microdvd import ( diff --git a/tests/fixtures/dfxp.py b/tests/fixtures/dfxp.py index a02a054b..3cc4bcb0 100644 --- a/tests/fixtures/dfxp.py +++ b/tests/fixtures/dfxp.py @@ -1521,3 +1521,31 @@ def sample_dfxp_default_styling_p_tags(): """ + + +@pytest.fixture(scope="session") +def sample_dfxp_concurrent_with_empty_p(): + return """\ + + + + +