@@ -7,8 +7,7 @@ reusing test patterns from test_html_extraction.py that are known to pass.
|
||||
|
||||
import unittest
|
||||
from bs4 import BeautifulSoup, Tag
|
||||
from pyWebLayout.io.rea
|
||||
ders.html_extraction import (
|
||||
from pyWebLayout.io.readers.html_extraction import (
|
||||
create_base_context,
|
||||
apply_element_styling,
|
||||
parse_inline_styles,
|
||||
@@ -245,7 +244,7 @@ class TestHandlerFunctions(unittest.TestCase):
|
||||
# Should match original test expectations
|
||||
self.assertEqual(len(result), 4) # 4 words
|
||||
|
||||
words = list(result.words())
|
||||
words = list(result.words_iter())
|
||||
expected_texts = ["This", "is", "a", "paragraph."]
|
||||
for i, expected_text in enumerate(expected_texts):
|
||||
self.assertEqual(words[i][1].text, expected_text)
|
||||
@@ -267,7 +266,7 @@ class TestHandlerFunctions(unittest.TestCase):
|
||||
self.assertEqual(result.level, expected_level)
|
||||
|
||||
# Should match original test word expectations
|
||||
words = list(result.words())
|
||||
words = list(result.words_iter())
|
||||
self.assertEqual(len(words), 2) # "Heading" and number
|
||||
self.assertEqual(words[0][1].text, "Heading")
|
||||
|
||||
@@ -450,7 +449,7 @@ class TestStyledContentHandling(unittest.TestCase):
|
||||
result = paragraph_handler(element, self.base_context)
|
||||
|
||||
self.assertIsInstance(result, Paragraph)
|
||||
words = list(result.words())
|
||||
words = list(result.words_iter())
|
||||
self.assertEqual(len(words), 7) # From original test expectation
|
||||
|
||||
# Check that 'bold' and 'text' words have bold font weight (from original test)
|
||||
@@ -475,7 +474,7 @@ class TestStyledContentHandling(unittest.TestCase):
|
||||
result = paragraph_handler(element, self.base_context)
|
||||
|
||||
self.assertIsInstance(result, Paragraph)
|
||||
words = list(result.words())
|
||||
words = list(result.words_iter())
|
||||
|
||||
# Check for bold word (from original test pattern)
|
||||
bold_words = [w for _, w in words if w.style.weight == FontWeight.BOLD]
|
||||
|
||||
Reference in New Issue
Block a user