@@ -38,6 +38,29 @@ def it_knows_whether_it_contains_a_page_break(
3838
3939 assert paragraph .contains_page_break == expected_value
4040
41+ @pytest .mark .parametrize (
42+ ("p_cxml" , "count" ),
43+ [
44+ ("w:p" , 0 ),
45+ ("w:p/w:r" , 0 ),
46+ ("w:p/w:hyperlink" , 1 ),
47+ ("w:p/(w:r,w:hyperlink,w:r)" , 1 ),
48+ ("w:p/(w:r,w:hyperlink,w:r,w:hyperlink)" , 2 ),
49+ ("w:p/(w:hyperlink,w:r,w:hyperlink,w:r)" , 2 ),
50+ ],
51+ )
52+ def it_provides_access_to_the_hyperlinks_it_contains (
53+ self , p_cxml : str , count : int , fake_parent : t .StoryChild
54+ ):
55+ p = cast (CT_P , element (p_cxml ))
56+ paragraph = Paragraph (p , fake_parent )
57+
58+ hyperlinks = paragraph .hyperlinks
59+
60+ actual = [type (item ).__name__ for item in hyperlinks ]
61+ expected = ["Hyperlink" for _ in range (count )]
62+ assert actual == expected , f"expected: { expected } , got: { actual } "
63+
4164 def it_knows_its_paragraph_style (self , style_get_fixture ):
4265 paragraph , style_id_ , style_ = style_get_fixture
4366 style = paragraph .style
0 commit comments