Ë
    ¶:Qg·  ã                  óÄ   — d Z ddlmZ ddlmZmZmZ ddlZddlm	Z	m
Z
 ddlmZmZ ddlmZmZmZ  G d„ d	«      Z G d
„ d«      Z G d„ d«      Z	 	 d	 	 	 	 	 	 	 dd„Zdd„Zy)z@Unit-test suite for the `unstructured.chunking.dispatch` module.é    )Úannotations)ÚAnyÚIterableÚOptionalN)Úadd_chunking_strategyÚregister_chunking_strategy)Ú_ChunkerSpecÚchunk)ÚCompositeElementÚElementÚTextc                  ó   — e Zd ZdZd„ Zd„ Zy)ÚDescribe_add_chunking_strategyzNUnit-test suite for `unstructured.chunking.add_chunking_strategy()` decorator.c                óV   — t        t        «      } |d¬«      }|t        d«      gk(  sJ ‚y )NÚbasic)Úchunking_strategyzLorem ipsum.

Sit amet.)r   Úpartition_thisr   )ÚselfÚdecorated_partitionerÚchunkss      úe/var/www/html/answerous/venv/lib/python3.12/site-packages/test_unstructured/chunking/test_dispatch.pyÚ?it_dispatches_the_partitioned_elements_to_the_indicated_chunkerz^Describe_add_chunking_strategy.it_dispatches_the_partitioned_elements_to_the_indicated_chunker   s/   € Ü 5´nÓ EÐá&¸ÔAˆàÔ*Ð+FÓGÐHÒHÐHÑHó    c                óf   — t        t        «      } |«       }|t        d«      t        d«      gk(  sJ ‚y )NúLorem ipsum.ú	Sit amet.)r   r   r   )r   r   Úelementss      r   Ú<but_it_skips_dispatch_when_no_chunking_strategy_is_specifiedz[Describe_add_chunking_strategy.but_it_skips_dispatch_when_no_chunking_strategy_is_specified   s2   € Ü 5´nÓ EÐá(Ó*ˆàœD Ó0´$°{Ó2CÐDÒDÐDÑDr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   © r   r   r   r      s   „ ÙXòIóEr   r   c                  ó   — e Zd ZdZd„ Zd„ Zy)ÚDescribe_chunkzFUnit-test suite for `unstructured.chunking.dispatch.chunk()` function.c                ó’   — t        dt        «       dddœ}t        t        d«      t        d«      gdfi |¤Ž}|t	        d«      gk(  sJ ‚y )NÚby_something_elseiî  Úbar)Úmax_charactersÚfooÚLoremÚIpsumz=chunked 2 elements with `(max_characters=750, whizbang=None)`)r   Úchunk_by_something_elser
   r   r   )r   Úkwargsr   s      r   ÚAit_dispatches_to_the_chunker_registered_for_the_chunking_strategyzPDescribe_chunk.it_dispatches_to_the_chunker_registered_for_the_chunking_strategy%   s^   € Ü"Ð#6Ô8OÔPà!ð ñ	
ˆô œ˜W›¤t¨G£}Ð5Ð7JÑUÈfÑUˆàÜÐ\Ó]ð
ò 
ð 	
ñ 
r   c                ó~   — t        j                  t        d¬«      5  t        g d¬«       d d d «       y # 1 sw Y   y xY w)Nz'unrecognized chunking strategy 'foobar')ÚmatchÚfoobar)r   r   )ÚpytestÚraisesÚ
ValueErrorr
   )r   s    r   Ú@it_raises_when_the_requested_chunking_strategy_is_not_registeredzODescribe_chunk.it_raises_when_the_requested_chunking_strategy_is_not_registered4   s5   € Ü]‰]ÜØ;ô
ñ 	;ô ˜2°Õ:÷		;÷ 	;ñ 	;ús   œ3³<N)r   r    r!   r"   r/   r6   r#   r   r   r%   r%   "   s   „ ÙPò
ó;r   r%   c                  ó   — e Zd ZdZd„ Zd„ Zy)ÚDescribe_ChunkerSpeczJUnit-test suite for `unstructured.chunking.dispatch._ChunkerSpec` objects.c                óJ   — t        t        «      }|j                  t        u sJ ‚y )N)r	   r-   Úchunker©r   Úspecs     r   Ú+it_provides_access_to_the_chunking_functionz@Describe_ChunkerSpec.it_provides_access_to_the_chunking_function?   s    € ÜÔ3Ó4ˆØ|‰|Ô6Ñ6Ð6Ñ6r   c                óD   — t        t        «      }|j                  dk(  sJ ‚y )N)r)   Úwhizbang)r	   r-   Úkw_arg_namesr;   s     r   Ú<it_knows_which_keyword_args_the_chunking_function_can_acceptzQDescribe_ChunkerSpec.it_knows_which_keyword_args_the_chunking_function_can_acceptC   s"   € ÜÔ3Ó4ˆØ× Ñ Ð$BÒBÐBÑBr   N)r   r    r!   r"   r=   rA   r#   r   r   r8   r8   <   s   „ ÙTò7óCr   r8   c           	     óV   — t        | «      }t        dt        |«      › d|› d|› d«      gS )z3A "fake" minimal chunker suitable for use in tests.zchunked z  elements with `(max_characters=z, whizbang=z)`)Úlistr   Úlen)r   r)   r?   Úelss       r   r-   r-   K   sC   € ô ˆx‹.€CäØ”s˜3“xjð !!Ø!/Ð 0°¸H¸:ÀRðIó	
ðð r   c                 ó.   — t        d«      t        d«      gS )zA fake partitioner.r   r   )r   )r.   s    r   r   r   Z   s   € äÓ ¤$ {Ó"3Ð4Ð4r   )NN)r   zIterable[Element]r)   zOptional[int]r?   zOptional[float]Úreturnúlist[Element])r.   r   rG   rH   )r"   Ú
__future__r   Útypingr   r   r   r3   Úunstructured.chunkingr   r   Úunstructured.chunking.dispatchr	   r
   Úunstructured.documents.elementsr   r   r   r   r%   r8   r-   r   r#   r   r   ú<module>rN      s{   ðñ Gå "ç *Ñ *ã ç Sß >ß KÑ K÷Eñ E÷$;ñ ;÷4	Cñ 	Cð" %)Ø $ðØðà!ðð ðð ó	ô5r   