This commit is contained in:
parent
8dce1569c0
commit
ce7293824e
@ -416,8 +416,8 @@ class ContainerAware:
|
|||||||
"""
|
"""
|
||||||
if not hasattr(container, required_method):
|
if not hasattr(container, required_method):
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
f"Container {
|
f"Container {type(container).__name__} must have a '{required_method}' method"
|
||||||
type(container).__name__} must have a '{required_method}' method")
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _inherit_style(cls, container, style=None):
|
def _inherit_style(cls, container, style=None):
|
||||||
|
|||||||
@ -461,9 +461,8 @@ class EPUBReader:
|
|||||||
block._loaded_image = self.image_processor(block._loaded_image)
|
block._loaded_image = self.image_processor(block._loaded_image)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(
|
print(
|
||||||
f"Warning: Image processing failed for image '{
|
f"Warning: Image processing failed for image '{block.alt_text}': {str(e)}"
|
||||||
block.alt_text}': {
|
)
|
||||||
str(e)}")
|
|
||||||
# Continue with unprocessed image
|
# Continue with unprocessed image
|
||||||
|
|
||||||
def _process_content_images(self):
|
def _process_content_images(self):
|
||||||
|
|||||||
@ -81,8 +81,8 @@ class Font:
|
|||||||
logger.debug(f"Font loading: assets_dir = {assets_dir}")
|
logger.debug(f"Font loading: assets_dir = {assets_dir}")
|
||||||
logger.debug(f"Font loading: bundled_font_path = {bundled_font_path}")
|
logger.debug(f"Font loading: bundled_font_path = {bundled_font_path}")
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Font loading: bundled font exists = {
|
f"Font loading: bundled font exists = {os.path.exists(bundled_font_path)}"
|
||||||
os.path.exists(bundled_font_path)}")
|
)
|
||||||
|
|
||||||
if os.path.exists(bundled_font_path):
|
if os.path.exists(bundled_font_path):
|
||||||
logger.info(f"Found bundled font at: {bundled_font_path}")
|
logger.info(f"Found bundled font at: {bundled_font_path}")
|
||||||
|
|||||||
@ -91,8 +91,8 @@ class TestLinkedWordHyphenation(unittest.TestCase):
|
|||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
text_obj,
|
text_obj,
|
||||||
LinkText,
|
LinkText,
|
||||||
f"Hyphenated LinkedWord part should be LinkText, got {
|
f"Hyphenated LinkedWord part should be LinkText, got {type(text_obj)}"
|
||||||
type(text_obj)}")
|
)
|
||||||
self.assertEqual(text_obj.link.location, linked_word.location)
|
self.assertEqual(text_obj.link.location, linked_word.location)
|
||||||
|
|
||||||
# The overflow should also be LinkText if it's hyphenated
|
# The overflow should also be LinkText if it's hyphenated
|
||||||
|
|||||||
@ -381,8 +381,8 @@ class TestEPUBReader(unittest.TestCase):
|
|||||||
# Each chapter should start with a heading
|
# Each chapter should start with a heading
|
||||||
first_block = blocks[0]
|
first_block = blocks[0]
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
first_block, Heading, f"Chapter {
|
first_block, Heading, f"Chapter {i + 1} should start with heading"
|
||||||
i + 1} should start with heading")
|
)
|
||||||
|
|
||||||
def test_epub_styled_content(self):
|
def test_epub_styled_content(self):
|
||||||
"""Test that styled content in EPUB is properly parsed."""
|
"""Test that styled content in EPUB is properly parsed."""
|
||||||
|
|||||||
@ -51,8 +51,8 @@ class TestHTMLFileLoader(unittest.TestCase):
|
|||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
block,
|
block,
|
||||||
Block,
|
Block,
|
||||||
f"Item {i} should be a Block instance, got {
|
f"Item {i} should be a Block instance, got {type(block)}"
|
||||||
type(block)}")
|
)
|
||||||
|
|
||||||
print(f"Successfully loaded and parsed HTML file with {len(blocks)} blocks")
|
print(f"Successfully loaded and parsed HTML file with {len(blocks)} blocks")
|
||||||
|
|
||||||
|
|||||||
@ -335,10 +335,8 @@ class TestDocumentLayouterIntegration:
|
|||||||
line = test_page.children[0]
|
line = test_page.children[0]
|
||||||
min_spacing, max_spacing = line._spacing
|
min_spacing, max_spacing = line._spacing
|
||||||
|
|
||||||
assert min_spacing == case["expected_min"], f"Min constraint failed for {
|
assert min_spacing == case["expected_min"], f"Min constraint failed for {case['name']}"
|
||||||
case['name']}"
|
assert max_spacing == case["expected_max"], f"Max constraint failed for {case['name']}"
|
||||||
assert max_spacing == case["expected_max"], f"Max constraint failed for {
|
|
||||||
case['name']}"
|
|
||||||
|
|
||||||
print(f"✓ {case['name']}: constraints ({min_spacing}, {max_spacing})")
|
print(f"✓ {case['name']}: constraints ({min_spacing}, {max_spacing})")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user