a
    ¡˜ëjØÜ  ã                   @  sl  d Z ddlmZ ddlmZ ddlZddlmZ ddlm	Z	m
Z
mZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZ dd	„ Zej d
g d¢¡ddd
œdd„ƒZG dd„ dƒZ G dd„ dƒZ!G dd„ dƒZ"G dd„ dƒZ#G dd„ dƒZ$G dd„ dƒZ%G dd„ dƒZ&G dd„ dƒZ'G dd „ d ƒZ(G d!d"„ d"ƒZ)G d#d$„ d$ƒZ*G d%d&„ d&ƒZ+G d'd(„ d(ƒZ,dS ))z;Test suite for `unstructured.partition.html.parser` module.é    ©Úannotations)ÚdequeN)Úetree)ÚAddressÚElementÚListItemÚNarrativeTextÚTextÚTitle)Ú
AnnotationÚDefaultElementÚFlowÚPhrasingÚRemovedPhrasingÚTextSegmentÚ_consolidate_annotationsÚ_ElementAccumulatorÚ_normalize_textÚ_PhraseAccumulatorÚ_PreElementAccumulatorÚhtml_parserc                  C  sž   dddddœdddœg} t | ƒ} | ddgddgdgdgdœksBJ ‚tjtd	d
�� d| d< W d   ƒ n1 sn0    Y  | d  d¡ | d g d¢ksšJ ‚d S )NzFord Prefectzhttps://wikipedia/Ford_PrefectÚb)Ú
link_textsÚlink_urlÚemphasized_text_contentsÚemphasized_text_tagszalien encounterÚbi©r   r   )r   r   r   r   z'object does not support item assignment)ÚmatchÚfoobarZnew_keyr   Úxyz)r   r   r!   )r   ÚpytestÚraisesÚ	TypeErrorÚappendr   © r&   úk/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/test_unstructured/partition/html/test_parser.pyÚ7it_consolidates_annotations_from_multiple_text_segments"   s(    üþùú	&r(   ©ÚtextÚexpected_value))úiterators allowr,   )zalgorithm
to   bezalgorithm to be)z  separated
  from  zseparated from)z
 container
 details
 zcontainer details)zM
  iterators  allow 
 algorithm to be   
expressed  without container  
noisezAiterators allow algorithm to be expressed without container noiseÚstrc                 C  s   t | ƒ|ksJ ‚d S ©N)r   r)   r&   r&   r'   Ú,test_normalize_text_produces_normalized_textE   s    r/   c                   @  s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚDescribe_PhraseAccumulatorzUIsolated unit-test suite for `unstructured.partition.html.parser._PhraseAccumulator`.c                 C  sD   t ƒ }| ¡ }t t¡� t|ƒ W d   ƒ n1 s60    Y  d S r.   ©r   Úflushr"   r#   ÚStopIterationÚnext©ÚselfÚaccumÚphrase_iterr&   r&   r'   Úit_is_empty_on_construction^   s    z6Describe_PhraseAccumulator.it_is_empty_on_constructionc                 C  sˆ   t ƒ }| tdi ƒ¡ | tdi ƒ¡ | ¡ }t|ƒ}|tdi ƒtdi ƒfksRJ ‚t t¡� t|ƒ W d   ƒ n1 sz0    Y  d S )NúFord... you're turning úinto a penguin.)r   Úaddr   r2   r4   r"   r#   r3   )r6   r7   r8   Úphraser&   r&   r'   Úit_accumulates_text_segmentsh   s    þ
z7Describe_PhraseAccumulator.it_accumulates_text_segmentsc                 C  sD   t ƒ }| ¡ }t t¡� t|ƒ W d   ƒ n1 s60    Y  d S r.   r1   r5   r&   r&   r'   Ú-it_generates_zero_phrases_on_flush_when_emptyz   s    zHDescribe_PhraseAccumulator.it_generates_zero_phrases_on_flush_when_emptyN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r9   r>   r?   r&   r&   r&   r'   r0   [   s   
r0   c                   @  sb  e Zd ZdZddœdd„Zddœdd„Zddœdd	„Zddœd
d„Zddœdd„Zddœdd„Z	ddœdd„Z
ddœdd„Zddœdd„Zdd„ Zddœdd„Zej dddedfddedfd d!edfd"d!ed#fd$d!ed%fd&dedfd'd(edfd)d*ed#fd+d,ed%fd-d.ed/fd0d1ed2fd3d4ed5fg¡d6d6d7d8dœd9d:„ƒZddœd;d<„Ze ¡ dd=œd>d?„ƒZdS )@ÚDescribe_ElementAccumulatorzVIsolated unit-test suite for `unstructured.partition.html.parser._ElementAccumulator`.zetree.ElementBase)Úhtml_elementc                 C  sH   t |ƒ}| d ¡}t t¡� t|ƒ W d   ƒ n1 s:0    Y  d S r.   ©r   r2   r"   r#   r3   r4   ©r6   rE   r7   Úelement_iterr&   r&   r'   r9   †   s    
z7Describe_ElementAccumulator.it_is_empty_on_constructionc                 C  s€   t |ƒ}| tdi ƒ¡ | tdi ƒ¡ | d ¡}t|ƒ}|tdƒksJJ ‚t t¡� t|ƒ W d   ƒ n1 sr0    Y  d S )Nr:   r;   ú&Ford... you're turning into a penguin.)	r   r<   r   r2   r4   r	   r"   r#   r3   )r6   rE   r7   rH   Úelementr&   r&   r'   r>   �   s    
z8Describe_ElementAccumulator.it_accumulates_text_segmentsc                 C  sH   t |ƒ}| d ¡}t t¡� t|ƒ W d   ƒ n1 s:0    Y  d S r.   rF   rG   r&   r&   r'   Ú%it_generates_zero_elements_when_emptyŸ   s    
zADescribe_ElementAccumulator.it_generates_zero_elements_when_emptyc                 C  sd   t |ƒ}| tdi ƒ¡ | tdi ƒ¡ t t¡� t| d ¡ƒ W d   ƒ n1 sV0    Y  d S )Nú 
   	 
z   
©r   r<   r   r"   r#   r3   r4   r2   ©r6   rE   r7   r&   r&   r'   ÚMand_it_generates_zero_elements_when_all_its_text_segments_are_whitespace_only§   s
    ziDescribe_ElementAccumulator.and_it_generates_zero_elements_when_all_its_text_segments_are_whitespace_onlyc                 C  sd   t |ƒ}| tdi ƒ¡ | tdi ƒ¡ t t¡� t| d ¡ƒ W d   ƒ n1 sV0    Y  d S )NrL   z X 
rM   rN   r&   r&   r'   ÚNand_it_generates_zero_elements_when_there_is_only_one_non_whitespace_character±   s
    zjDescribe_ElementAccumulator.and_it_generates_zero_elements_when_there_is_only_one_non_whitespace_characterc                 C  sF   t |ƒ}| tdi ƒ¡ | tdi ƒ¡ | d ¡\}|jdksBJ ‚d S ©Nz 
  Ford...   you're 	 turning
zinto a   penguin.
rI   )r   r<   r   r2   r*   ©r6   rE   r7   rJ   r&   r&   r'   Ú4it_normalizes_the_text_of_its_text_segments_on_flush»   s
    zPDescribe_ElementAccumulator.it_normalizes_the_text_of_its_text_segments_on_flushc                 C  s8   t |ƒ}| tdi ƒ¡ | t¡\}|tdƒks4J ‚d S ©NrI   ©r   r<   r   r2   r   rR   r&   r&   r'   Ú3it_creates_a_document_element_of_the_specified_typeÄ   s    zODescribe_ElementAccumulator.it_creates_a_document_element_of_the_specified_typec                 C  s8   t |ƒ}| tdi ƒ¡ | d ¡\}|tdƒks4J ‚d S rT   )r   r<   r   r2   r	   rR   r&   r&   r'   ÚDbut_it_derives_the_element_type_from_the_text_when_none_is_specifiedÌ   s    z`Describe_ElementAccumulator.but_it_derives_the_element_type_from_the_text_when_none_is_specifiedc                 C  s8   t |ƒ}| tdi ƒ¡ | d ¡\}|tdƒks4J ‚d S )Nz* turning into a penguinzturning into a penguinrU   rR   r&   r&   r'   Ú@it_removes_an_explicit_leading_bullet_character_from_a_list_itemÖ   s    z\Describe_ElementAccumulator.it_removes_an_explicit_leading_bullet_character_from_a_list_itemc                 C  sh   t  dt¡ d¡d }t|ƒ}| tdi ƒ¡ | t¡\}| 	¡ }| 
d¡ |ddiddd	œksdJ ‚d S )
Nz<h3>About fish</h3>z.//h3r   zThanks for all those!Ú
element_idZcategory_depthé   r   ©Úmetadatar*   Útype)r   Ú
fromstringr   Úxpathr   r<   r   r2   r   Úto_dictÚpop©r6   rE   r7   rJ   Úer&   r&   r'   Ú"it_applies_category_depth_metadataà   s    
ýz>Describe_ElementAccumulator.it_applies_category_depth_metadatac                 C  s˜   t |ƒ}| tddddœƒ¡ | tdi ƒ¡ | tddddœƒ¡ | tdi ƒ¡ | t¡\}| ¡ }| d	¡ |ddgddgdœd
ddœks”J ‚d S )Nz
    Ford...ZFordr   r   z you're turning into a ÚpenguinÚiz.
rY   rI   r	   r[   )r   r<   r   r2   r	   r`   ra   rb   r&   r&   r'   Ú-and_it_consolidates_annotations_into_metadataï   sB    þþÿ	þþÿ	
þþû
ôzIDescribe_ElementAccumulator.and_it_consolidates_annotations_into_metadata)Ú	html_textÚtagÚ
ElementClsr+   z5<p>Ford... you're turning into a penguin. Stop it.<p>ÚpNz!<p>* thanks for all the fish.</p>r   z!<li>thanks for all the fish.</li>Úliz><ul><li>So long</li><li>and thanks for all the fish.</li></ul>é   z><dl><dd>So long<ol><li>and thanks for the fish.</li></ol></ul>rZ   z<p>Examples</p>z<h1>Examples</h1>Úh1z<h2>Examples</h2>Úh2z<h3>Examples</h3>Úh3z<h4>Examples</h4>Úh4é   z<h5>Examples</h5>Úh5é   z<h6>Examples</h6>Úh6é   r-   ztype[Element]z
int | Nonec                 C  s:   t  |t¡ d|› �¡d }t|ƒ}| |¡|ks6J ‚d S )Nz.//r   )r   r^   r   r_   r   Z_category_depth)r6   rh   ri   rj   r+   rc   r7   r&   r&   r'   Ú&it_computes_the_category_depth_to_help  s    zBDescribe_ElementAccumulator.it_computes_the_category_depth_to_helpc                 C  s:   t |ƒ}| tdi ƒ¡ | tdi ƒ¡ |jdks6J ‚d S rQ   )r   r<   r   Ú_normalized_textrN   r&   r&   r'   Ú<it_computes_the_normalized_text_of_its_text_segments_to_help5  s    zXDescribe_ElementAccumulator.it_computes_the_normalized_text_of_its_text_segments_to_help)Úreturnc                 C  s   t  dt¡ d¡d S )Nú<p/>ú.//pr   )r   r^   r   r_   )r6   r&   r&   r'   rE   @  s    z(Describe_ElementAccumulator.html_element)r@   rA   rB   rC   r9   r>   rK   rO   rP   rS   rV   rW   rX   rd   rg   r"   ÚmarkÚparametrizer
   r   r   rw   ry   ZfixturerE   r&   r&   r&   r'   rD   ƒ   s@   


	

,











ôþ	rD   c                   @  s   e Zd ZdZdd„ ZdS )ÚDescribe_PreElementAccumulatorzYIsolated unit-test suite for `unstructured.partition.html.parser._PreElementAccumulator`.c                 C  sp   t  dt¡ d¡d }t|ƒ}| tdi ƒ¡ | tdi ƒ¡ | tdi ƒ¡ | tdi ƒ¡ |jdkslJ ‚d S )	Nr{   r|   r   z

z    The panel lit up
z(    with the words 'Please do not press
z    this button again'

zU
    The panel lit up
    with the words 'Please do not press
    this button again'
)r   r^   r   r_   r   r<   r   rx   rN   r&   r&   r'   ry   H  s    ÿz[Describe_PreElementAccumulator.it_computes_the_normalized_text_of_its_text_segments_to_helpN)r@   rA   rB   rC   ry   r&   r&   r&   r'   r   E  s   r   c                   @  sÌ   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
ej dddi fgfddi fddddœfdi fddddœfdi fgfddi fddddœfddd dœfd!i fgfg¡d"d#dœd$d%„ƒZd&S )'ÚDescribeFlowz›Isolated unit-test suite for `unstructured.partition.html.parser.Flow`.

    The `Flow` class provides most behaviors for flow (block-level) elements.
    c                 C  s6   t  dt¡ d¡d }t|tƒs$J ‚|jdu s2J ‚d S )Nz<p>Hello</p>r|   r   F)r   r^   r   r_   Ú
isinstancer   Úis_phrasing)r6   rk   r&   r&   r'   Ú%it_knows_it_is_NOT_a_phrasing_elementd  s    z2DescribeFlow.it_knows_it_is_NOT_a_phrasing_elementc                 C  sd  d}t  |t¡ d¡d }| ¡ }t|ƒ}|tdƒks:J ‚|j ¡ g d¢g d¢dœksZJ ‚t|ƒ}|t	dƒksrJ ‚|j ¡ d	gd
gdœksŽJ ‚t|ƒ}|tdƒks¦J ‚|j ¡ g d¢g d¢dœksÆJ ‚t|ƒ}|tdƒksÞJ ‚|j ¡ i ksðJ ‚t|ƒ}|tdƒk�s
J ‚|j ¡ ddgddgdœk�s,J ‚t
 t¡� t|ƒ}W d  ƒ n1 �sV0    Y  dS )a?  Phrasing siblings of child block elements are processed with text or tail.

        In the general case, a Flow element can contain text, phrasing content, and child flow
        elements.

        Each of these five lines in this example is a "paragraph" and gives rise to a distinct
        document-element.
        a¸  
          <div>
            Text of div <b>with <i>hierarchical</i>
phrasing</b> content before first block item
            <p>Click <a href="http://blurb.io">here</a> to see the blurb for this block item. </p>
            tail of block item <b>with <i>hierarchical</i> phrasing </b> content
            <p>second block item</p>
            tail of block item <b>with <i>  hierarchical  </i></b> phrasing content
          </div>
        ú.//divr   zFText of div with hierarchical phrasing content before first block item)ÚwithÚhierarchicalZphrasing©r   r   r   r   z0Click here to see the blurb for this block item.Úherezhttp://blurb.io©r   Ú	link_urlsz5tail of block item with hierarchical phrasing contentzsecond block itemr…   r†   r   r   N)r   r^   r   r_   Úiter_elementsr4   r
   r\   r`   r	   r"   r#   r3   ©r6   rh   ÚdivÚelementsrc   r&   r&   r'   Ú8it_generates_the_document_elements_from_the_Flow_elementl  s:    		þþþzEDescribeFlow.it_generates_the_document_elements_from_the_Flow_elementc                 C  sj   d}t  |t¡ d¡d }| |jt|ƒt¡}t|ƒ}|tdƒksFJ ‚|j	 
¡ g d¢g d¢dœksfJ ‚dS )	zJText and tails and their phrasing content are both processed the same way.zK<div>The 
 Roman <b>poet <i>   Virgil</i> gave</b> his <q>pet</q> fly</div>r„   r   z&The Roman poet Virgil gave his pet fly)ZpoetZVirgilZgaver‡   r   N)r   r^   r   r_   Ú_element_from_text_or_tailr*   r   r
   r4   r\   r`   rŒ   r&   r&   r'   Ú4it_assembles_text_and_tail_document_elements_to_helpŸ  s    þzADescribeFlow.it_assembles_text_and_tail_document_elements_to_helpc                 C  sd   d}t  |t¡ d¡d }| |jt|ƒt¡}t 	t
¡� t|ƒ W d   ƒ n1 sV0    Y  d S )Nz6<div>   <b> 
 <i>  
 </i>  </b>   <q> 
 </q> 
  </div>r„   r   )r   r^   r   r_   r�   r*   r   r
   r"   r#   r3   r4   ©r6   rh   r�   rŽ   r&   r&   r'   ÚMbut_it_does_not_generate_a_document_element_when_only_whitespace_is_contained¯  s
    zZDescribeFlow.but_it_does_not_generate_a_document_element_when_only_whitespace_is_containedc                 C  sŽ   d}t  |t¡ d¡d }| |jt|ƒt¡}t|ƒ}|tdƒksFJ ‚|j	 
¡ i ksXJ ‚t t¡� t|ƒ W d   ƒ n1 s€0    Y  d S )Nz;<div>
  The line-storm clouds fly tattered and swift
</div>r„   r   z,The line-storm clouds fly tattered and swift)r   r^   r   r_   r�   r*   r   r   r4   r\   r`   r"   r#   r3   rŒ   r&   r&   r'   Ú@it_uses_the_specified_element_class_to_form_the_document_element¸  s    zMDescribeFlow.it_uses_the_specified_element_class_to_form_the_document_elementc                 C  sD   d}t  |t¡ d¡d }| |jt|ƒ¡}t|ƒtdƒks@J ‚d S )Nz<<div>
  The line-storm clouds fly tattered and swift,
</div>r„   r   z-The line-storm clouds fly tattered and swift,)	r   r^   r   r_   r�   r*   r   r4   r	   r’   r&   r&   r'   ÚRand_it_selects_the_document_element_class_by_analyzing_the_text_when_not_specifiedÄ  s    z_DescribeFlow.and_it_selects_the_document_element_class_by_analyzing_the_text_when_not_specifiedc                 C  sb   d}t  |t¡ d¡d }| |jt|ƒ¡}t t	¡� t
|ƒ W d   ƒ n1 sT0    Y  d S )Nz<div> * </div>r„   r   )r   r^   r   r_   r�   r*   r   r"   r#   r3   r4   r’   r&   r&   r'   ÚUbut_it_does_not_generate_a_document_element_when_only_a_bullet_character_is_containedÌ  s
    zbDescribeFlow.but_it_does_not_generate_a_document_element_when_only_a_bullet_character_is_contained©rh   r+   z,<p>Ford... you're turning into a penguin.<p>rI   z:<p>Ford... <b>you're turning</b> into
a <i>penguin</i>.<p>zFord... zyou're turningr   r   z into
a re   rf   Ú.z:<p>Ford... <b>you're <i>turning</i></b> into a penguin.<p>zyou're zyou'reÚturningr   z into a penguin.r-   zlist[Annotation]c                 C  s<   t  |t¡ d¡d }t| |jt|ƒ¡ƒ}||ks8J ‚d S )Nr|   r   )r   r^   r   r_   ÚlistZ_iter_text_segmentsr*   r   )r6   rh   r+   rk   Útext_segmentsr&   r&   r'   ÚEit_recursively_generates_text_segments_from_text_and_phrasing_to_help×  s    +zRDescribeFlow.it_recursively_generates_text_segments_from_text_and_phrasing_to_helpN)r@   rA   rB   rC   rƒ   r�   r‘   r“   r”   r•   r–   r"   r}   r~   rœ   r&   r&   r&   r'   r€   \  sN   3	þþþõþþþöþëþ(r€   c                   @  sB   e Zd ZdZdd„ Zej dg d¢¡dddœdd„ƒZd	d
„ Z	dS )ÚDescribePrez¤Isolated unit-test suite for `unstructured.partition.html.parser.Pre`.

    The `Pre` class specializes behaviors for the `<pre>` (pre-formatted text) element.
    c                 C  sp   d}t  |t¡ d¡d }| ¡ }t|ƒ}|tdƒks:J ‚t t	¡� t|ƒ W d  ƒ n1 sb0    Y  dS )z4A `<pre>` element can contain only phrasing content.z£<pre>
  The Answer to the Great Question...   Of Life, the Universe and Everything...
  Is... Forty-two, said Deep Thought, with infinite majesty and calm.
</pre>
ú.//prer   z•  The Answer to the Great Question...   Of Life, the Universe and Everything...
  Is... Forty-two, said Deep Thought, with infinite majesty and calm.N)
r   r^   r   r_   r‹   r4   r
   r"   r#   r3   )r6   rh   ÚprerŽ   rc   r&   r&   r'   Ú9it_preserves_the_whitespace_of_its_phrasing_only_contents  s    ÿÿ
zEDescribePre.it_preserves_the_whitespace_of_its_phrasing_only_contentsr—   ))z<pre>
  foo  </pre>ú  foo  )z<pre> 
  foo  </pre>z	 
  foo  )z<pre>

  foo  </pre>z
  foo  )z<pre>  foo  
</pre>r¡   )z<pre>  foo  
 </pre>z	  foo  
 )z<pre>  foo  

</pre>z  foo  
)z<pre>
  foo  
</pre>r¡   )z<pre> 
  foo  
 </pre>z 
  foo  
 r-   c                 C  s4   t  |t¡ d¡d }t| ¡ ƒ}|j|ks0J ‚dS )zSContent starts on next line when opening `<pre>` tag is immediately followed by `
`rž   r   N)r   r^   r   r_   r4   r‹   r*   )r6   rh   r+   rŸ   rc   r&   r&   r'   Ú2but_it_strips_a_single_leading_or_trailing_newline"  s    z>DescribePre.but_it_strips_a_single_leading_or_trailing_newlinec                 C  s€   d}t  |t¡ d¡d }t| ¡ ƒ}|jdks4J ‚|jjdgksFJ ‚|jj	dgksXJ ‚|jj
dgksjJ ‚|jjdgks|J ‚d S )	NzL<pre>You're <b>turning</b> into a <a href="http://eie.io">penguin</a>.</pre>rž   r   zYou're turning into a penguin.r™   r   re   úhttp://eie.io)r   r^   r   r_   r4   r‹   r*   r\   r   r   r   rŠ   )r6   rh   rŸ   rc   r&   r&   r'   ÚPit_assigns_emphasis_and_link_metadata_when_contents_have_those_phrasing_elements@  s    z\DescribePre.it_assigns_emphasis_and_link_metadata_when_contents_have_those_phrasing_elementsN)
r@   rA   rB   rC   r    r"   r}   r~   r¢   r¤   r&   r&   r&   r'   r�     s   þ	r�   c                   @  s   e Zd ZdZdd„ ZdS )ÚDescribeRemovedBlockz¯Isolated unit-test suite for `unstructured.partition.html.parser.RemovedBlock`.

    This class is used for block level items we want to skip like `<hr/>` and `<figure>`.
    c                 C  s8   d}t  |t¡ d¡d }t| ¡ ƒtdƒgks4J ‚d S )Na&  
          <div>
            <hr/>
            <figure>
              <img src="/media/cc0-images/elephant-660-480.jpg" alt="Elephant at sunset" />
              <figcaption>An elephant at sunset</figcaption>
            </figure>
            <p>Content we want.</p>
          </div>
          r„   r   zContent we want.)r   r^   r   r_   rš   r‹   r	   )r6   rh   r�   r&   r&   r'   Úit_is_skipped_during_parsingS  s    
z1DescribeRemovedBlock.it_is_skipped_during_parsingN)r@   rA   rB   rC   r¦   r&   r&   r&   r'   r¥   M  s   r¥   c                   @  s¢  e Zd ZdZdd„ Zej ddg fddi fgfdd	i fgfd
di fdi fgfddi fdi fdi fdi fdi fgfg¡dddœdd„ƒZej dde	dƒgfde
ddddœƒe	dƒgfde	dƒe
ddddœƒgfde
ddddœƒe	dƒe
ddddœƒgfg¡dddœdd„ƒZd d!„ Zej d"d#d$g¡dd%œd&d'„ƒZd(d)„ Zej d*g d+¢¡dd,œd-d.„ƒZej dd/g fd0e
di ƒgfd1e
di ƒe
di ƒgfd2e
di ƒe
di ƒe
di ƒe
d3i ƒe
d4i ƒe
d5i ƒgfg¡dddœd6d7„ƒZej d8d9d#g fd:d#e	dƒgfd;d#e	dƒe
di ƒgfd<d#e	dƒe
di ƒe
di ƒe
d3i ƒgfd=de
ddddœƒe	dƒe
ddddœƒe
d3d3ddœƒe
d4d4ddœƒgfg¡dddd8œd>d?„ƒZej d@dAd#g fdBd#e
di ƒgfdCd#e
di ƒgfdDd#e
di ƒe
di ƒgfdEd#e
di ƒe
di ƒe
di ƒe
d3i ƒe
d4i ƒgfdFde
ddddœƒe
ddddœƒe
dddGdœƒe
d3d3ddœƒe
d4d4ddœƒgfdHd#e
di ƒe
di ƒe	dƒe
d3i ƒe
d4i ƒgfg¡dddd@œdIdJ„ƒZdKS )LÚDescribePhrasingz¢Isolated unit-test suite for `unstructured.partition.html.parser.Phrasing`.

    The `Phrasing` class provides most behaviors for phrasing (inline) elements.
    c                 C  s6   t  dt¡ d¡d }t|tƒs$J ‚|jdu s2J ‚d S )Nz<b>Hello</b>ú.//br   T)r   r^   r   r_   r�   r   r‚   )r6   r   r&   r&   r'   Ú!it_knows_it_is_a_phrasing_elementn  s    z2DescribePhrasing.it_knows_it_is_a_phrasing_elementr—   z<code></code>z<data> foo </data>z foo z<dfn/> bar z bar z.<kbd><mark>foo <meter>bar</meter></mark></kbd>zfoo Úbarz4<kbd> <mark>foo <meter>bar</meter> baz</mark> </kbd>ú z bazr-   úlist[TextSegment]c                 C  s2   t  |t¡ d¡d d }t| ¡ ƒ|ks.J ‚d S ©Nú.//bodyr   ©r   r^   r   r_   rš   Úiter_text_segments©r6   rh   r+   rc   r&   r&   r'   Ú=it_generates_text_segments_for_its_text_and_children_and_tailv  s    zNDescribePhrasing.it_generates_text_segments_for_its_text_and_children_and_tailz<strong><p>aaa</p></strong>Úaaaz<strong>aaa<p>bbb</p></strong>r   r   Úbbbz<strong><p>aaa</p>bbb</strong>z!<strong>aaa<p>bbb</p>ccc</strong>Úccczlist[TextSegment | Element]c                 C  s2   t  |t¡ d¡d d }t| ¡ ƒ|ks.J ‚d S r­   r¯   r±   r&   r&   r'   ÚFbut_it_can_also_generate_an_element_when_it_has_a_nested_block_element”  s    +zWDescribePhrasing.but_it_can_also_generate_an_element_when_it_has_a_nested_block_elementc                 C  s4   t  dt¡ d¡d }| dd¡dddœks0J ‚d S )Nú<cite/>ú.//citer   z
  foobar
  r   r    r   ©r   r^   r   r_   Ú_annotation©r6   Úciter&   r&   r'   Ú&it_forms_its_annotations_from_emphasisÄ  s
    
þz7DescribePhrasing.it_forms_its_annotations_from_emphasisr*   Ú z
  	  ©r*   c                 C  s.   t  dt¡ d¡d }| |d¡i ks*J ‚d S )Nr·   r¸   r   r   r¹   )r6   r*   r¼   r&   r&   r'   Ú(but_not_when_text_is_empty_or_whitespaceË  s    z9DescribePhrasing.but_not_when_text_is_empty_or_whitespacec                 C  s.   t  dt¡ d¡d }| dd¡i ks*J ‚d S )Nr·   r¸   r   r    r¾   r¹   r»   r&   r&   r'   Ú!and_not_when_there_is_no_emphasisÐ  s    z2DescribePhrasing.and_not_when_there_is_no_emphasisÚenclosing_emphasis)r¾   r   r   )rÂ   c                 C  s,   t  dt¡ d¡d }| |¡|ks(J ‚dS )zäInside emphasis is applied to text inside the phrasing element (but not its tail).

        The `._inside_emphasis()` method is overridden by Bold and Italic classes which add their
        specific emphasis characters.
        z<abbr/>z.//abbrr   N)r   r^   r   r_   Z_inside_emphasis)r6   rÂ   Zabbrr&   r&   r'   Ú=it_uses_the_enclosing_emphasis_as_the_default_inside_emphasisÖ  s    	zNDescribePhrasing.it_uses_the_enclosing_emphasis_as_the_default_inside_emphasisz<abbr>aaa</abbr>z<bdi>x<bdo>bbb</bdo></bdi>z<bdi>x<bdo>bbb</bdo>ccc</bdi>zG<big>xxx<cite>aaa<code>bbb<data>ccc</data>ddd</code>eee</cite>fff</big>ZdddZeeeZfffc                 C  s4   t  |t¡ d¡d d }t| d¡ƒ|ks0J ‚d S )Nr®   r   r¾   ©r   r^   r   r_   rš   Z_iter_child_text_segmentsr±   r&   r&   r'   Ú;it_generates_text_segments_for_its_children_and_their_tailsä  s    zLDescribePhrasing.it_generates_text_segments_for_its_children_and_their_tails)rh   Úinside_emphasisr+   z<dfn></dfn>z<kbd><p>aaa</p></kbd>z<kbd><p>aaa</p>bbb</kbd>z+<kbd><p>aaa</p>bbb<mark>ccc</mark>ddd</kbd>z5<strong><q>aaa</q><p>bbb</p>ccc<s>ddd</s>eee</strong>c                 C  s4   t  |t¡ d¡d d }t| |¡ƒ|ks0J ‚d S r­   rÄ   )r6   rh   rÆ   r+   rc   r&   r&   r'   Ú0and_it_generates_elements_for_its_block_children  s    -zADescribePhrasing.and_it_generates_elements_for_its_block_children©rh   Úemphasisr+   z<cite><p/></cite>z<cite><p/>aaa</cite>z<cite><p/><s>aaa</s></cite>z<bdi><p/><s>aaa</s>bbb</bdi>z,<sub><p/>aaa<s>bbb<q>ccc</q>ddd</s>eee</sub>z2<strong><p/>aaa<s>bbb<i>ccc</i>ddd</s>eee</strong>r   z4<cite><p/>aaa<abbr>bbb<p>ccc</p>ddd</abbr>eee</cite>c                 C  s`   t  |t¡ d¡d d }| d¡d }|jp0d}t|dd … ƒ}t| |||¡ƒ|ks\J ‚d S )Nr®   r   z./pr¾   rm   )r   r^   r   r_   Útailr   rš   Z0_iter_text_segments_from_block_tail_and_phrasing)r6   rh   rÉ   r+   rc   rk   rÊ   Úqr&   r&   r'   Ú@it_generates_text_segments_from_the_tail_and_contiguous_phrasing4  s    >
ÿÿzQDescribePhrasing.it_generates_text_segments_from_the_tail_and_contiguous_phrasingN)r@   rA   rB   rC   r©   r"   r}   r~   r²   r
   r   r¶   r½   rÀ   rÁ   rÃ   rÅ   rÇ   rÌ   r&   r&   r&   r'   r§   f  s.  ûþöþ
ÿüþ
ÿþþ
ÿ
ÿûþèþ(úþ÷þüý
ÿ
ÿ
ÿ
ÿõýíþ*ûý
ÿ
ÿ
ÿ
ÿ
ÿóýûýÔþ;r§   c                   @  s†  e Zd ZdZej dddg fddedi ƒgfddedi ƒgfd	ded
dgdgdœƒgfdded
dgdgdœƒedi ƒgfddeddgdgdgdgdœƒedi ƒgfddeddgdgdgdgdœƒeddddœƒgfg¡ddddœdd „ƒZd!d"„ Z	d#d$„ Z
d%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zd1d2„ Zd3d4„ Zd5d6„ Zd7d8„ Zd9d:„ Zd;d<„ Zej d=dd>g¡dd?œd@dA„ƒZdBdC„ ZdDS )EÚDescribeAnchorz™Isolated unit-test suite for `unstructured.partition.html.parser.Anchor`.

    The `Anchor` class is used for `<a>` tags and provides link metadata.
    rÈ   z<a href="http://abc.com"></a>r¾   z(<a href="http://abc.com"></a> long tail z long tail z<a href="http://abc.com">  </a>z  z)<a href="http://abc.com"> click here </a>z click here z
click hereúhttp://abc.comr‰   z3<a href="http://abc.com"> click here </a> long tailz
 long tailzI<p>I am <a href="http://eie.io">one <u>with<i> the</i></u> Force</a>.</p>zone with the ForceZtherf   r£   ©r   r   r   rŠ   r˜   zL<p>I am <strong><a href="http://eie.io">one with</a> the Force.</strong></p>r   úone withú the Force.ú
the Force.r   r-   r¬   c                 C  s0   t  |t¡ d¡d }t| |¡ƒ|ks,J ‚d S )Nú.//ar   r¯   )r6   rh   rÉ   r+   Úar&   r&   r'   ÚNit_generates_link_annotated_text_segments_for_its_text_and_a_tail_text_segment…  s    Nz]DescribeAnchor.it_generates_link_annotated_text_segments_for_its_text_and_a_tail_text_segmentc                 C  sb   d}t  |t¡ d¡d }t| d¡ƒtddgdgdgdgdœƒtd	ƒtd
dddœƒgks^J ‚d S )Nz;<a href="http://eie.io">I am <p>one with</p> the Force.</a>rÓ   r   r   zI am zI amr£   rÏ   rÐ   rÑ   rÒ   r   )r   r^   r   r_   rš   r°   r   r
   ©r6   rh   rÔ   r&   r&   r'   Ú6it_generates_enclosed_block_items_as_separate_elementsÖ  s&    üþ	þþõzEDescribeAnchor.it_generates_enclosed_block_items_as_separate_elementsc                 C  s€   d}t  |t¡ d¡d }t| d¡ƒ}|tdi ƒtdƒtdddd	œƒgksPJ ‚|d
 }|jj	dgksjJ ‚|jj
dgks|J ‚d S )Nz><a href="http://eie.io"> 
 <p>I am one with</p> the Force.</a>rÓ   r   rf   z 
 zI am one withrÑ   rÒ   r   rm   r£   )r   r^   r   r_   rš   r°   r   r	   r\   r   rŠ   )r6   rh   rÔ   ÚactualrJ   r&   r&   r'   ÚYand_it_annotates_first_enclosed_block_Element_when_no_non_whitespace_phrase_appears_firstî  s     þþý
zhDescribeAnchor.and_it_annotates_first_enclosed_block_Element_when_no_non_whitespace_phrase_appears_firstc                 C  sP   d}t  |t¡ d¡d }t|jdd�ƒtdi ƒftdƒtdi ƒfgksLJ ‚d S )	Nzi
          <a href="http://eie.io">But always <p>see first.</p> Otherwise you </a> will only see
        rÓ   r   r¾   )rÉ   úBut always ú
see first.z Otherwise you )r   r^   r   r_   rš   Z_iter_phrases_and_elementsr   r	   rÖ   r&   r&   r'   ÚEit_divides_the_anchor_contents_but_not_tail_into_phrases_and_elements  s    

ýzTDescribeAnchor.it_divides_the_anchor_contents_but_not_tail_into_phrases_and_elementsc                 C  s`   d}t  |t¡ d¡d }t t¡�( t|jdt	g ƒdd�ƒ W d   ƒ n1 sR0    Y  d S )Nú<a href="http://eie.io"></a>rÓ   r   r¾   ©r*   rË   rÉ   )
r   r^   r   r_   r"   r#   r3   r4   Ú_iter_phrasingr   rÖ   r&   r&   r'   Ú6it_generates_zero_items_when_both_text_and_q_are_empty  s    zEDescribeAnchor.it_generates_zero_items_when_both_text_and_q_are_emptyc                 C  sJ   d}t  |t¡ d¡d }t|j|jt|ƒdd�ƒtdi ƒfgksFJ ‚d S )Nz5<a href="http://eie.io">
  But always see first.
</a>rÓ   r   r¾   rÞ   z
  But always see first.
©	r   r^   r   r_   rš   rß   r*   r   r   rÖ   r&   r&   r'   Ú/it_generates_a_phrase_when_only_text_is_present  s
    
ÿz>DescribeAnchor.it_generates_a_phrase_when_only_text_is_presentc                 C  sn   d}t  |t¡ d¡d }t|j|jt|ƒdd�ƒtdi ƒtddd	d
œƒtdddd
œƒtdi ƒfgksjJ ‚d S )NzI<a href="http://eie.io">But always <b>see <i>first</i></b>. Otherwise</a>rÓ   r   r¾   rÞ   rÚ   zsee Zseer   r   Úfirstr   z. Otherwiserá   rÖ   r&   r&   r'   ÚJand_it_generates_a_phrase_when_that_text_is_followed_by_a_phrasing_element$  s&    þþþþðÿzYDescribeAnchor.and_it_generates_a_phrase_when_that_text_is_followed_by_a_phrasing_elementc                 C  sJ   d}t  |t¡ d¡d }t|j|jt|ƒdd�ƒtdi ƒfgksFJ ‚d S )NzE<a href="http://eie.io">But always see first.</a> Otherwise you will rÓ   r   r¾   rÞ   zBut always see first.rá   rÖ   r&   r&   r'   Ú,it_ends_the_phrase_at_the_end_of_the_element=  s
    
ÿz;DescribeAnchor.it_ends_the_phrase_at_the_end_of_the_elementc                 C  sJ   d}t  |t¡ d¡d }t|j|jt|ƒdd�ƒtdi ƒfgksFJ ‚d S )NzH<a href="http://eie.io">But always see first. <p>Otherwise you </p> </a>rÓ   r   r¾   rÞ   zBut always see first. rá   rÖ   r&   r&   r'   Ú2but_it_ends_at_a_block_element_if_one_occurs_firstE  s
    
ÿzADescribeAnchor.but_it_ends_at_a_block_element_if_one_occurs_firstc                 C  sv   d}t  |t¡ d¡d }t|j|jt|ƒdd�ƒtdi ƒtddd	d
œƒft	dƒtddd	d
œƒtdi ƒfgksrJ ‚d S )Nzk
          <a href="http://eie.io">But <strong>always <p>see first.</p>Otherwise</strong> you </a>
        rÓ   r   r¾   rÞ   zBut zalways Úalwaysr   r   rÛ   Ú	Otherwisez you )
r   r^   r   r_   rš   rß   r*   r   r   r	   rÖ   r&   r&   r'   Ú?it_generates_an_element_for_a_block_item_nested_inside_phrasingM  s*    þþþ
þþøôzNDescribeAnchor.it_generates_an_element_for_a_block_item_nested_inside_phrasingc                 C  s`   d}t  |t¡ d¡d }tdƒ}| |¡}||u s8J ‚|jjdgksJJ ‚|jjdgks\J ‚d S )NrÝ   rÓ   r   r³   r£   ©	r   r^   r   r_   r
   Ú_link_annotate_elementr\   r   rŠ   ©r6   rh   rÔ   rJ   rc   r&   r&   r'   Ú+it_adds_link_metadata_to_an_element_to_helpm  s    
z:DescribeAnchor.it_adds_link_metadata_to_an_element_to_helpc                 C  sx   d}t  |t¡ d¡d }tdƒ}dg|j_dg|j_| |¡}||u sLJ ‚|jjddgks`J ‚|jjddgkstJ ‚d S )NrÝ   rÓ   r   r´   ÚabcrÎ   r£   )	r   r^   r   r_   r
   r\   r   rŠ   rë   rì   r&   r&   r'   Ú:and_it_preserves_any_existing_link_metadata_on_the_elementx  s    


zIDescribeAnchor.and_it_preserves_any_existing_link_metadata_on_the_elementc                 C  s\   d}t  |t¡ d¡d }tdƒ}| |¡}||u s8J ‚|jjd u sHJ ‚|jjd u sXJ ‚d S )Nz<a href="http://eie.io"/>rÓ   r   r¾   rê   rì   r&   r&   r'   Úbut_not_when_the_text_is_empty†  s    
z-DescribeAnchor.but_not_when_the_text_is_emptyc                 C  s\   d}t  |t¡ d¡d }tdƒ}| |¡}||u s8J ‚|jjd u sHJ ‚|jjd u sXJ ‚d S )Nz<a/>rÓ   r   Zzzzrê   rì   r&   r&   r'   Úand_not_when_there_is_no_url‘  s    
z+DescribeAnchor.and_not_when_there_is_no_urlc                 C  st   d}t  |t¡ d¡d }tddgdgdœƒtdd	d
dœƒf}| |¡}|tddd	gdd
gdgdgdœƒkspJ ‚d S )NrÝ   rÓ   r   zOtherwise you will only rè   rf   r   zsee what you were expecting.
Z	expectingr   z5Otherwise you will only see what you were expecting.
z4Otherwise you will only see what you were expecting.r£   rÏ   ©r   r^   r   r_   r   Z_link_text_segment)r6   rh   rÔ   r=   Zlink_text_segmentr&   r&   r'   ÚIit_consolidates_a_phrase_into_a_single_link_annotated_TextSegment_to_helpž  s0    þþþþø
üþzXDescribeAnchor.it_consolidates_a_phrase_into_a_single_link_annotated_TextSegment_to_helpr*   z 
 	 r¿   c                 C  sL   d}t  |t¡ d¡d }t|i ƒt|i ƒt|i ƒf}| |¡d u sHJ ‚d S )NrÝ   rÓ   r   rò   )r6   r*   rh   rÔ   r=   r&   r&   r'   Ú1but_not_when_the_text_is_empty_or_whitespace_only¾  s    z@DescribeAnchor.but_not_when_the_text_is_empty_or_whitespace_onlyc                 C  sD   d}t  |t¡ d¡d }tdi ƒtdi ƒf}| |¡d u s@J ‚d S )Nz<a>foobar</a>rÓ   r   rè   z	 you willrò   )r6   rh   rÔ   r=   r&   r&   r'   Ú'and_not_when_the_anchor_has_no_href_urlÆ  s    z6DescribeAnchor.and_not_when_the_anchor_has_no_href_urlN)r@   rA   rB   rC   r"   r}   r~   r   rÕ   r×   rÙ   rÜ   rà   râ   rä   rå   ræ   ré   rí   rï   rð   rñ   ró   rô   rõ   r&   r&   r&   r'   rÍ   }  s”   þÿýþûýüþ	öýüþ	þþöýÏþK  rÍ   c                   @  s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚDescribeBoldz¤Isolated unit-test suite for `unstructured.partition.html.parser.Bold`.

    The `Bold` class is used for `<b>` and `<strong>` tags and adds emphasis metadata.
    c                 C  sL   t  dt¡ d¡d }| ¡ }t|ƒ\}}|dks6J ‚|dddœksHJ ‚d S )Nz<b>rhombus</b>r¨   r   Úrhombusr   r   ©r   r^   r   r_   r°   r4   ©r6   r   r›   r*   Ú
annotationr&   r&   r'   Ú0it_annotates_its_text_segment_with_bold_emphasisÔ  s    þz=DescribeBold.it_annotates_its_text_segment_with_bold_emphasisc                 C  sv   t  dt¡ d¡d }| ¡ }t|ƒ\}}|dks6J ‚|dddœksHJ ‚t|ƒ\}}|dks`J ‚|dd	dœksrJ ‚d S )
Nz<b>rhombus <i>pentagon</i></b>r¨   r   úrhombus r÷   r   r   Úpentagonr   rø   rù   r&   r&   r'   Ú6and_its_children_are_also_annotated_with_bold_emphasisà  s    þþzCDescribeBold.and_its_children_are_also_annotated_with_bold_emphasisc                 C  sp   t  dt¡ d¡d }| ¡ }t|ƒ\}}|dks6J ‚|dddœksHJ ‚t|ƒ\}}|dks`J ‚|i kslJ ‚d S )Nz<b>rhombus</b> pentagonr¨   r   r÷   r   r   ú	 pentagonrø   rù   r&   r&   r'   Úbut_not_its_tailò  s    þzDescribeBold.but_not_its_tailN)r@   rA   rB   rC   rû   rþ   r   r&   r&   r&   r'   rö   Î  s   rö   c                   @  s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚDescribeItalicz¤Isolated unit-test suite for `unstructured.partition.html.parser.Italic`.

    The `Italic` class is used for `<i>` and `<em>` tags and adds emphasis metadata.
    c                 C  sL   t  dt¡ d¡d }| ¡ }t|ƒ\}}|dks6J ‚|dddœksHJ ‚d S )Nz<i>rhombus</i>ú.//ir   r÷   rf   r   rø   ©r6   rf   r›   r*   rú   r&   r&   r'   Ú2it_annotates_its_text_segment_with_italic_emphasis  s    þzADescribeItalic.it_annotates_its_text_segment_with_italic_emphasisc                 C  sv   t  dt¡ d¡d }| ¡ }t|ƒ\}}|dks6J ‚|dddœksHJ ‚t|ƒ\}}|dks`J ‚|dd	dœksrJ ‚d S )
Nz <em>rhombus <b>pentagon</b></em>z.//emr   rü   r÷   rf   r   rý   r   rø   )r6   Úemr›   r*   rú   r&   r&   r'   Ú8and_its_children_are_also_annotated_with_italic_emphasis  s    þþzGDescribeItalic.and_its_children_are_also_annotated_with_italic_emphasisc                 C  sp   t  dt¡ d¡d }| ¡ }t|ƒ\}}|dks6J ‚|dddœksHJ ‚t|ƒ\}}|dks`J ‚|i kslJ ‚d S )Nz<i>rhombus</i> pentagonr  r   r÷   rf   r   rÿ   rø   r  r&   r&   r'   r   &  s    þzDescribeItalic.but_not_its_tailN)r@   rA   rB   rC   r  r  r   r&   r&   r&   r'   r    s   r  c                   @  s   e Zd ZdZdd„ ZdS )ÚDescribeLineBreaka:  Isolated unit-test suite for `unstructured.partition.html.parser.LineBreak`.

    Used for `<br/>` elements, it's only special behavior is to add whitespace such that phrasing
    butted up tight on both sides of the `<br/>` element is not joined, like `abc<br/>def` should
    become "abc def", not "abcdef".
    c                 C  sV   t  dt¡ d¡d }| ¡ }dd„ |D ƒ}|g d¢ks<J ‚td |¡ƒdksRJ ‚d S )	Nz:<cite>spaceships of the<br/>Vogon Constructor Fleet</cite>r¸   r   c                 S  s   g | ]
}|j ‘qS r&   r¿   ©Ú.0Útsr&   r&   r'   Ú
<listcomp>E  ó    zDDescribeLineBreak.it_adds_a_newline_in_its_place.<locals>.<listcomp>)zspaceships of theÚ
zVogon Constructor Fleetr¾   z)spaceships of the Vogon Constructor Fleet)r   r^   r   r_   r°   r   Újoin)r6   r¼   r›   Útextsr&   r&   r'   Úit_adds_a_newline_in_its_place>  s    ÿþþz0DescribeLineBreak.it_adds_a_newline_in_its_placeN)r@   rA   rB   rC   r  r&   r&   r&   r'   r  6  s   r  c                   @  s   e Zd ZdZdd„ ZdS )ÚDescribeRemovedPhrasingz÷Isolated unit-test suite for `unstructured.partition.html.parser.RemovedPhrasing`.

    Used for phrasing elements like `<label>` that we want to skip, including any content they
    enclose. The tail of such an element is not skipped though.
    c                 C  sR   t  dt¡ d¡d }t| ¡ ƒ\}t|tƒs2J ‚|jdu s@J ‚|j	dksNJ ‚d S )Nzh<div>
  <label>Space<p>is big</p>, <b>mind-bogglingly</b> big.</label>
  Like vastly, hugely big.
</div>z.//labelr   Tz
  Like vastly, hugely big.
)
r   r^   r   r_   rš   r°   r�   r   r‚   r*   )r6   ÚlabelZtext_segmentr&   r&   r'   Ú it_behaves_like_an_empty_elementQ  s    ûúúz8DescribeRemovedPhrasing.it_behaves_like_an_empty_elementN)r@   rA   rB   rC   r  r&   r&   r&   r'   r  J  s   r  c                   @  s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚDescribeDefaultElementaë  Isolated unit-test suite for `unstructured.partition.html.parser.DefaultElement`.

    Used for any element we haven't assigned a custom element-class too. This prominently includes
    any non-HTML elements that can be embedded in the HTML.

    It identifies as a block item but it can behave as either a block-item or phrasing. Its behavior
    is a combination of RemovedBlock and RemovedPhrasing. Namely, it iterates zero elements and only
    iterates a text-segment for its tail.
    c                 C  s6   t  dt¡ d¡d }t|tƒs$J ‚|jdu s2J ‚d S )Nz<foobar>Vogon</foobar>ú	.//foobarr   T)r   r^   r   r_   r�   r   r‚   )r6   r    r&   r&   r'   Ú#it_identifies_as_a_phrasing_elementq  s    z:DescribeDefaultElement.it_identifies_as_a_phrasing_elementc                 C  sT   t  dt¡ d¡d }| ¡ }t t¡� t|ƒ W d  ƒ n1 sF0    Y  dS )z0Should never be called but belts and suspenders.z@<foobar>Space<p>is big</p>, <b>mind-bogglingly</b> big.</foobar>r  r   N)	r   r^   r   r_   r‹   r"   r#   r3   r4   )r6   r    rŽ   r&   r&   r'   Ú*it_generates_zero_elements_as_a_block_itemy  s    þýýzADescribeDefaultElement.it_generates_zero_elements_as_a_block_itemc                 C  s:   t  dt¡ d¡d }dd„ | ¡ D ƒ}|dgks6J ‚d S )Nú¾<div>
  O Deep Thought computer, he said,
  <foobar>Vogon Constructor Fleet</foobar>
  The task we have designed you to perform is this.
  <p>We want you to tell us.... he paused,</p>
</div>r  r   c                 S  s   g | ]
}|j ‘qS r&   r¿   r  r&   r&   r'   r  ’  r  zuDescribeDefaultElement.it_generates_its_tail_but_no_inner_text_segments_when_called_like_phrasing.<locals>.<listcomp>z7
  The task we have designed you to perform is this.
  )r   r^   r   r_   r°   )r6   r    r  r&   r&   r'   ÚJit_generates_its_tail_but_no_inner_text_segments_when_called_like_phrasing‡  s    ùøø
zaDescribeDefaultElement.it_generates_its_tail_but_no_inner_text_segments_when_called_like_phrasingc                 C  s<   t  dt¡ d¡d }dd„ | ¡ D ƒ}|ddgks8J ‚d S )Nr  r„   r   c                 S  s   g | ]
}|j ‘qS r&   r¿   )r	  rc   r&   r&   r'   r  ¡  r  zoDescribeDefaultElement.and_it_behaves_like_an_empty_phrasing_element_inside_a_block_element.<locals>.<listcomp>zSO Deep Thought computer, he said, The task we have designed you to perform is this.z%We want you to tell us.... he paused,)r   r^   r   r_   r‹   )r6   r�   r  r&   r&   r'   ÚDand_it_behaves_like_an_empty_phrasing_element_inside_a_block_element–  s    ùøø
þz[DescribeDefaultElement.and_it_behaves_like_an_empty_phrasing_element_inside_a_block_elementN)r@   rA   rB   rC   r  r  r  r  r&   r&   r&   r'   r  d  s
   r  )-rC   Ú
__future__r   Úcollectionsr   r"   Úlxmlr   Zunstructured.documents.elementsr   r   r   r	   r
   r   Z"unstructured.partition.html.parserr   r   r   r   r   r   r   r   r   r   r   r   r(   r}   r~   r/   r0   rD   r   r€   r�   r¥   r§   rÍ   rö   r  r  r  r  r&   r&   r&   r'   Ú<module>   s>    8#þ( C -E    S44