
    :Qg0]                       d Z ddlmZ ddlZddlZddlZddlmZ ddlZ	ddl
mZ ddlZddlmZ ddlmZmZmZ ddlmZmZmZmZmZ ddlmZ dd	lmZmZmZm Z  dd
l!m"Z"m#Z#m$Z$m%Z% dZ&dZ'd Z(d Z)d Z*d Z+ejX                  j[                  dddg      d,d       Z.d Z/d Z0d Z1d Z2d Z3d-dZ4d Z5d-dZ6d Z7d Z8d Z9d  Z:d! Z;d" Z<d# Z=d$ Z>d% Z? G d& d'      Z@ G d( d)      ZA G d* d+      ZBy).z8Test-suite for the `unstructured.partition.xlsx` module.    )annotationsN)Any)MockerFixture)EXPECTED_TABLE_XLSXEXPECTED_TEXT_XLSXEXPECTED_TITLE)FixtureRequestMockassert_round_trips_through_JSONexample_doc_pathfunction_mock)clean_extra_whitespace)ListItemTableTextTitle)_ConnectedComponent_SubtableParser_XlsxPartitionerOptionspartition_xlsxzAapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheetzStanley Cupsc                 4   t        dd      } t        d | D              dk(  sJ t        |       dk(  sJ t        | d   j                        t
        k(  sJ t        | d   j                        t        k(  sJ | d   j                  j                  t        k(  sJ | d   j                  j                  dk(  sJ | d   j                  j                  t        k(  sJ | d   j                  j                  t        k(  sJ | d   j                  j                  d	k(  sJ y )
Nexample-docs/stanley-cups.xlsxFinclude_headerc              3  <   K   | ]  }t        |t                y wN
isinstancer   .0elements     b/var/www/html/answerous/venv/lib/python3.12/site-packages/test_unstructured/partition/test_xlsx.py	<genexpr>z4test_partition_xlsx_from_filename.<locals>.<genexpr>6        Bgz'5)B         r      stanley-cups.xlsx)r   sumlenr   textr   r   metadatatext_as_htmlr   page_numberfiletypeEXPECTED_FILETYPE	page_nameEXCEPTED_PAGE_NAMEfilenameelementss    r"   !test_partition_xlsx_from_filenamer7   3   s   >uUHBBBaGGGx=A!(1+"2"23~EEE!(1+"2"237IIIIA;,,0CCCCA;++q000A;((,====A;))-????A;((,????    c                 N   t        j                         } t        dd      5 }| j                  |j	                                d d d        t        | d      }t        d |D              dk(  sJ t        |      dk(  sJ t        |d   j                        dk(  sJ y # 1 sw Y   [xY w)	Nzexample-docs/emoji.xlsxrbFfiler   c              3  <   K   | ]  }t        |t                y wr   )r   r   r   s     r"   r#   zKtest_partition_xlsx_from_SpooledTemporaryFile_with_emoji.<locals>.<genexpr>G   s     AWz'4(Ar%   r(   r   u   🤠😅)
tempfileSpooledTemporaryFileopenwritereadr   r*   r+   r   r,   )fgr6   s      r"   8test_partition_xlsx_from_SpooledTemporaryFile_with_emojirE   B   s    %%'A	'	. !	1U;HAAAQFFFx=A!(1+"2"23zAAA s    BB$c                 x    t        j                  t        d      5  t                d d d        y # 1 sw Y   y xY w)Nz3Either 'filename' or 'file' argument must be specif)match)pytestraises
ValueErrorr    r8   r"   6test_partition_xlsx_raises_on_no_file_or_path_providedrL   L   s,    	z)^	_   s   09c                 <   t        ddd      } t        d | D              dk(  sJ t        d | D              dk(  sJ t        | d   j                        t        k(  sJ t        | d	   j                        t
        k(  sJ | d   j                  j                  dk(  sJ y )
Nr   testF)metadata_filenamer   c              3  <   K   | ]  }t        |t                y wr   r   r   s     r"   r#   zKtest_partition_xlsx_from_filename_with_metadata_filename.<locals>.<genexpr>V   r$   r%   r&   c              3  <   K   | ]  }t        |t                y wr   )r   r   r   s     r"   r#   zKtest_partition_xlsx_from_filename_with_metadata_filename.<locals>.<genexpr>W   r$   r%   r   r(   )r   r*   r   r,   r   r   r-   r4   r5   s    r"   8test_partition_xlsx_from_filename_with_metadata_filenamerR   Q   s    (FSXH BBBaGGGBBBaGGG!(1+"2"23~EEE!(1+"2"237IIIIA;((F222r8   infer_table_structureTFc                    t        d|       }|D cg c]  }t        |t              s| }}|D ]9  }t        |j                  d      xr |j                  j
                  d u}|| k(  r9J  y c c}w )Nr   )rS   r.   )r   r   r   hasattrr-   r.   )rS   r6   etable_elementstable_element$table_element_has_text_as_html_fields         r"   )test_partition_xlsx_infer_table_structurerZ   ]   s    (@UH "*BAZ5-AaBNB' MM**N; @&&334? 	- 47LLLLM Cs
   A-A-c                     t        dd      } t        |       dk(  sJ t        d | D              sJ | d   }|j                  dt        z   k(  sJ |j
                  j                  J y )Nr   Tr   r&   c              3  <   K   | ]  }t        |t                y wr   r   r    rV   s     r"   r#   z@test_partition_xlsx_from_filename_with_header.<locals>.<genexpr>o        6z!U#6r%   r   #Stanley Cups Unnamed: 1 Unnamed: 2 )r   r+   allr,   r   r-   r.   )r6   rV   s     r"   -test_partition_xlsx_from_filename_with_headerra   k   sm    >tTHx=A6X6666A66:=OOOOO::""...r8   c                 r   t        dd      5 } t        | d      }d d d        t        d D              dk(  sJ t        |      dk(  sJ t	        |d   j
                        t        k(  sJ t	        |d	   j
                        t        k(  sJ |d	   j                  j                  t        k(  sJ |d	   j                  j                  d	k(  sJ |d	   j                  j                  t        k(  sJ |d	   j                  j                  t        k(  sJ |d	   j                  j                   J y # 1 sw Y   xY w)
Nr   r:   Fr;   c              3  <   K   | ]  }t        |t                y wr   r   r   s     r"   r#   z0test_partition_xlsx_from_file.<locals>.<genexpr>y   r$   r%   r&   r'   r   r(   )r@   r   r*   r+   r   r,   r   r   r-   r.   r   r/   r0   r1   r2   r3   r4   rC   r6   s     r"   test_partition_xlsx_from_filere   u   s3   	.	5 @!q?@ BBBaGGGx=A!(1+"2"23~EEE!(1+"2"237IIIIA;,,0CCCCA;++q000A;((,====A;))-????A;((000@ @s   D,,D6c                    t        dd      5 } t        j                  | j                               }d d d        d_        t        |d      }t        d |D              dk(  sJ t        |      dk(  sJ t        |d	   j                        t        k(  sJ t        |d
   j                        t        k(  sJ |d
   j                  j                  t        k(  sJ |d
   j                  j                  d
k(  sJ |d
   j                  j                   t"        k(  sJ |d
   j                  j$                  t&        k(  sJ y # 1 sw Y   xY w)Nr   r:   z)stanley-cups-downloaded-from-network.xlsxFr;   c              3  <   K   | ]  }t        |t                y wr   r   r   s     r"   r#   zFtest_partition_xlsx_from_file_like_object_with_name.<locals>.<genexpr>   r$   r%   r&   r'   r   r(   )r@   ioBytesIOrB   namer   r*   r+   r   r,   r   r   r-   r.   r   r/   r0   r1   r2   r3   )rC   r<   r6   s      r"   3test_partition_xlsx_from_file_like_object_with_namerk      s,   	.	5 $zz!&&(#$;DI4>HBBBaGGGx=A!(1+"2"23~EEE!(1+"2"237IIIIA;,,0CCCCA;++q000A;((,====A;))-????$ $s   $D;;Ec                    t        dd      5 } t        | dd      }d d d        t        d D              dk(  sJ t        |d   j                        t
        k(  sJ |d   j                  j                  dk(  sJ y # 1 sw Y   `xY w)	Nr   r:   rN   F)r<   rO   r   c              3  <   K   | ]  }t        |t                y wr   r   r   s     r"   r#   zGtest_partition_xlsx_from_file_with_metadata_filename.<locals>.<genexpr>   r$   r%   r&   r(   )r@   r   r*   r   r,   r   r-   r4   rd   s     r"   4test_partition_xlsx_from_file_with_metadata_filenamern      s    	.	5 Z!qFSXYZ BBBaGGG!(1+"2"237IIIIA;((F222Z Zs   A;;Bc                    t        dd      5 } t        | d      }d d d        t              dk(  sJ t        d |D              sJ |d   }|j                  dt
        z   k(  sJ |j                  j                  J y # 1 sw Y   cxY w)	Nr   r:   Tr;   r&   c              3  <   K   | ]  }t        |t                y wr   r   r]   s     r"   r#   z<test_partition_xlsx_from_file_with_header.<locals>.<genexpr>   r^   r%   r   r_   )r@   r   r+   r`   r,   r   r-   r.   )rC   r6   rV   s      r"   )test_partition_xlsx_from_file_with_headerrq      s    	.	5 ?!q>? x=A6X6666A66:=OOOOO::""...? ?s   A==Bc                    d| j                  d       t        t        d            }t        fd|D              sJ y )N2024-05-01T15:37:282unstructured.partition.xlsx.get_last_modified_datereturn_valuer)   c              3  P   K   | ]  }|j                   j                  k(    y wr   r-   last_modified)r    rV   filesystem_last_modifieds     r"   r#   zXtest_partition_xlsx_from_file_path_gets_last_modified_from_filesystem.<locals>.<genexpr>   s!     Vqzz''+CCV   #&patchr   r   r`   )mockerr6   rz   s     @r"   Etest_partition_xlsx_from_file_path_gets_last_modified_from_filesystemr      sG    4
LL<Kc   ./BCDHVXVVVVr8   c                     t        t        d      d      5 } t        |       }d d d        t        d D              sJ y # 1 sw Y   xY w)Nr)   r:   )r<   c              3  L   K   | ]  }|j                   j                  d u   y wr   rx   r]   s     r"   r#   zHtest_partition_xlsx_from_file_gets_last_modified_None.<locals>.<genexpr>   s     BAqzz''4/B   "$r@   r   r   r`   rd   s     r"   5test_partition_xlsx_from_file_gets_last_modified_Noner      sJ    	23T	: *a!q)* BBBBB* *s   A  A	c                    d}d| j                  d|       t        t        d            }t        fd|D              sJ y )Nrs   2020-07-05T09:24:28rt   ru   r)   )metadata_last_modifiedc              3  P   K   | ]  }|j                   j                  k(    y wr   rx   r    rV   r   s     r"   r#   zTtest_partition_xlsx_from_file_path_prefers_metadata_last_modified.<locals>.<genexpr>   !     Taqzz''+AATr{   r|   )r~   rz   r6   r   s      @r"   Atest_partition_xlsx_from_file_path_prefers_metadata_last_modifiedr      sT    42
LL<Kc   ,-F\H T8TTTTr8   c                     dt        t        d      d      5 } t        |       }d d d        t        fdD              sJ y # 1 sw Y    xY w)Nr   r)   r:   )r<   r   c              3  P   K   | ]  }|j                   j                  k(    y wr   rx   r   s     r"   r#   zOtest_partition_xlsx_from_file_prefers_metadata_last_modified.<locals>.<genexpr>   r   r{   r   )rC   r6   r   s     @r"   <test_partition_xlsx_from_file_prefers_metadata_last_modifiedr      sX    2	23T	: Ya!qAWXY T8TTTTY Ys   AAc                 F    t        t        d      d      } t        |        y )Nr)   Fr   )r   r   r   r5   s    r"   test_partition_xlsx_with_jsonr      s    ./BCTYZH#H-r8   c                     t        dd      } t        d | D              dk(  sJ t        |       dk(  sJ | d   j                  j                  dgk(  sJ y )	Nr   Fr   c              3  <   K   | ]  }t        |t                y wr   r   r   s     r"   r#   zFtest_partition_xlsx_metadata_language_from_filename.<locals>.<genexpr>   r$   r%   r&   r'   r   eng)r   r*   r+   r-   	languagesr5   s    r"   3test_partition_xlsx_metadata_language_from_filenamer      sZ    >uUHBBBaGGGx=AA;))eW444r8   c                    t        d      g t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d	      t        d      t        d
      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d      t        d
      k(  sJ y )Nz%example-docs/xlsx-subtable-cases.xlsxz	a b c d erC   azb c d ebzc d e fza b c dz2. erV   rD   hza b czb c dd)r   r   r   r   rK   r8   r"   test_partition_xlsx_subtablesr      s*   AB #Gk#G#G 	c
#G 	i	#G
 	c
#G 	c
#G 	i#G 	i#G 	#G 	i#G 	c
#G 	c
#G 	c
#G 	i#G 	c
#G  	c
!#G" 	c
##G$ 	i%#G& 	c
'#G( 	c
)#G* 	i+#G, 	c
-#G. 	c
/#G0 	c
1#G2 	c
3#G4 	i5#G6 	c
7#G8 	c
9#G: 	g;#G< 	c
=#G> 	g?#G@ 	gA#GB 	c
C#GD 	c
E#G # # #r8   c                 X    t        d      } | d   j                  j                  dgk(  sJ y )Nr   r   r   r   r-   r   r5   s    r"   2test_partition_xlsx_element_metadata_has_languagesr     s-    >?HA;))eW444r8   c                     t        dd      } | D ch c]2  }|j                  j                  s|j                  j                  d   4 }}d|v sJ d|v sJ y c c}w )Nz'example-docs/language-docs/eng_spa.xlsxT)detect_language_per_elementr   r   spar   )r6   rV   langss      r"   7test_partition_eml_respects_detect_language_per_elementr     s_    1tH /7O!**:N:NQZZ!!!$OEOE>>E>> Ps
   AAc                     t        j                         } 	 t        j                  d       t        d       t        j                  |        y # t        j                  |        w xY w)Ni  z$example-docs/more-than-1k-cells.xlsx)sysgetrecursionlimitsetrecursionlimitr   )old_recursion_limits    r"   +test_partition_xlsx_with_more_than_1k_cellsr     sL    //13d#=>1212s    A A#c                 T    t        dd      } | t        d      t        d      gk(  sJ y )Nr   F)find_subtableSStanley Cups Team Location Stanley Cups Blues STL 1 Flyers PHI 2 Maple Leafs TOR 13[Stanley Cups Since 67 Team Location Stanley Cups Blues STL 1 Flyers PHI 2 Maple Leafs TOR 0)r   r   r5   s    r"   Stest_partition_xlsx_with_find_subtables_False_emits_one_Table_element_per_worksheetr   ,  s@    >eTHa	
 		
	   r8   c                 ~    t        ddd      } | t        d      t        d      gk(  sJ t        d | D              sJ y )Nr   F)r   rS   r   r   c              3  L   K   | ]  }|j                   j                  d u   y wr   )r-   r.   r]   s     r"   r#   zftest_partition_xlsx_with_find_subtables_False_and_infer_table_structure_False_works.<locals>.<genexpr>F  s     A1qzz&&$.Ar   )r   r   r`   r5   s    r"   Stest_partition_xlsx_with_find_subtables_False_and_infer_table_structure_False_worksr   9  s]    (UZH a	
 		
	    AAAAAr8   c                     e Zd ZdZej
                  j                  dddg      	 	 	 	 dd       Zej
                  j                  dddg      	 	 	 	 	 	 dd	       Zej
                  j                  dddg      	 	 	 	 dd
       Z	ej
                  j                  dddg      	 	 	 	 dd       Z
	 	 	 	 ddZ	 	 ddZddZ ej                         dd       Z ej                         dd       Zy)Describe_XlsxPartitionerOptionszRUnit-test suite for `unstructured.partition.xlsx._XlsxPartitionerOptions` objects.	arg_valueTFc                D    ||d<   t        di |}|j                  |u sJ y )Nr   rK   )r   r   selfr   	opts_argsoptss       r"   Vit_knows_whether_to_find_subtables_within_each_worksheet_or_return_table_per_worksheetzvDescribe_XlsxPartitionerOptions.it_knows_whether_to_find_subtables_within_each_worksheet_or_return_table_per_worksheetT  s/     &/	/"&33!!Y...r8   )r   expected_value)Tr   )FNc                F    ||d<   t        di |}|j                  |k(  sJ y Nr   rK   )r   header_row_idx)r   r   r   r   r   s        r"   (it_knows_the_header_row_index_for_PandaszHDescribe_XlsxPartitionerOptions.it_knows_the_header_row_index_for_Pandas]  s0     '0	"#&33""n444r8   c                D    ||d<   t        di |}|j                  |u sJ y r   )r   r   r   s       r"   Ait_knows_whether_to_include_column_headings_in_Table_text_as_htmlzaDescribe_XlsxPartitionerOptions.it_knows_whether_to_include_column_headings_in_Table_text_as_htmlf  s0     '0	"#&33""i///r8   c                D    ||d<   t        di |}|j                  |u sJ y )NrS   rK   )r   rS   r   s       r"   :it_knows_whether_to_include_text_as_html_in_Table_metadatazZDescribe_XlsxPartitionerOptions.it_knows_whether_to_include_text_as_html_in_Table_metadatao  s0     .7	)*&33))Y666r8   c                ~    d}d|d<   ||_         t        di |}|j                  }|j                  d       ||k(  sJ y )Nz2024-04-02T20:32:35za/b/spreadsheet.xlsx	file_pathrK   )rv   r   ry   assert_called_once_with)r   r   get_last_modified_date_rz   r   ry   s         r"   Ait_gets_last_modified_from_the_filesystem_when_a_path_is_providedzaDescribe_XlsxPartitionerOptions.it_gets_last_modified_from_the_filesystem_when_a_path_is_providedz  sS     $9 !7	+/G,&33**778NO 8888r8   c                n    t        j                  d      }||d<   t        di |}|j                  }|J y )Ns   abcdefgr<   rK   )rh   ri   r   ry   )r   r   r<   r   ry   s        r"   Rbut_it_falls_back_to_None_for_the_last_modified_date_when_no_file_path_is_providedzrDescribe_XlsxPartitionerOptions.but_it_falls_back_to_None_for_the_last_modified_date_when_no_file_path_is_provided  s@     zz*% 	&&33**$$$r8   c                F    d|d<   t        di |}|j                  dk(  sJ y )Nz
x/y/z.xlsxr   rK   )r   metadata_file_path)r   r   r   s      r"   ,it_uses_the_file_path_argument_when_providedzLDescribe_XlsxPartitionerOptions.it_uses_the_file_path_argument_when_provided  s-    !-	+&33&&,666r8   c                    t        |d      S )Nrt   )r   )r   requests     r"   r   z7Describe_XlsxPartitionerOptions.get_last_modified_date_  s    W&Z[[r8   c                    ddddddS )zAll default arguments for `_XlsxPartitionerOptions`.

        Individual argument values can be changed to suit each test. Makes construction of opts more
        compact for testing purposes.
        NTF)r   r<   r   r   rS   rK   )r   s    r"   r   z)Describe_XlsxPartitionerOptions.opts_args  s     !#%)
 	
r8   N)r   boolr   dict[str, Any])r   r   r   z
int | Noner   r   )r   r   r   r
   )r   r   )r   r	   )returnr   )__name__
__module____qualname____doc__rH   markparametrizer   r   r   r   r   r   r   fixturer   r   rK   r8   r"   r   r   Q  sU   \[[[4-8//*8/ 9/ [[<y->XY55/95FT5 Z5 [[[4-800*80 90 [[[4-877*87 979'9BF9	%'	%7 V^^\ \ V^^
 
r8   r   c                  "    e Zd ZdZd Zd Zd Zy)Describe_ConnectedComponentzNUnit-test suite for `unstructured.partition.xlsx._ConnectedComponent` objects.c                    t        t        j                         h d      }|j                  dk(  sJ |j                  dk(  sJ y )N>   r(   r&   r&   r&   r&      r   r(   r(   r(   r   r&   )r   pd	DataFramemin_xmax_x)r   	components     r"   !it_knows_its_top_and_left_extentsz=Describe_ConnectedComponent.it_knows_its_top_and_left_extents  s9    '8`a	!###!###r8   c                    t        j                         }t        |h d      }t        |h d      }|j                  |      }|j                  |u sJ |j
                  h dk(  sJ y )N>   r   r   r&   r   >   r   r'   r(   r   r(   r'   >   r   r   r   r   r   r   )r   r   r   merge
_worksheet_cell_coordinate_set)r   dfr   othermergeds        r"   ;it_can_merge_with_another_component_to_make_a_new_componentzWDescribe_ConnectedComponent.it_can_merge_with_another_component_to_make_a_new_component  s^    \\^',DE	#B(@A'  B&&&**.^^^^r8   c           	        t        j                  g dg ddgddgd dgg dggg d	      }h d
}t        ||      }|j                  }t	        d|       t        j                  |t        j                  ddgddgd dggg d	             y )Nr   r   cr   rV   rC   rD   r   i)r   r(   r&   r   r'         index>   r&   r   r&   r(   r   r   r   r(   r'   r(   z	subtable=)r&   r   r'   )r   r   r   subtableprintpdtassert_frame_equal)r   worksheet_dfcell_coordinate_setr   r  s        r"   Oit_can_extract_the_rectangular_subtable_containing_its_cells_from_the_worksheetzkDescribe_ConnectedComponent.it_can_extract_the_rectangular_subtable_containing_its_cells_from_the_worksheet  s    ||b3*sCj4+rC5Q'
 G'6IJ	%%nbllS#Jc
T3K#HPYZ	
r8   N)r   r   r   r   r   r   r	  rK   r8   r"   r   r     s    X$_
r8   r   c                     e Zd ZdZej
                  j                  d ej                  ddgddggddg	       ej                  ddgddggddg	      f ej                  dgddgdd
ggg d	       ej                  ddgdd
ggddg	      f ej                  ddgddgddgd
dggg d	       ej                  ddgd
dggddg	      f ej                  ddgddgdd
ggg d	       ej                  ddgddggddg	      f ej                  ddgddgd
gdggg d	       ej                  ddgddggddg	      f ej                  dgddgdd
gddggg d	       ej                  ddgdd
ggddg	      f ej                  dgdgddgd
dgdggg d	       ej                  ddgd
dggddg	      f ej                  ddgddgdd
gddgddggg d	       ej                  ddgdd
ggddg	      f ej                  dgdgddgd
dgdgdggg d	       ej                  ddgd
dggddg	      f ej                  g dgdg	       ej                  g dgdg	      f ej                  dgg dgddg	       ej                  g dgdg	      f ej                  g ddgd
ggg d	       ej                  g dgdg	      fg      	 	 	 	 dd       Z	ej
                  j                  d ej                  ddgddgg      g f ej                  dgddgdd
gg      dgf ej                  ddgddgddgd
dgg      ddgf ej                  ddgddgdd
gg      g f ej                  ddgddgd
gdgg      g f ej                  dgddgdd
gddgg      dgf ej                  dgdgddgd
dgdgg      ddgf ej                  ddgddgdd
gddgddgg      dgf ej                  dgdgddgd
dgdgdgg      ddgf ej                  g dg      g f ej                  dgg dg      dgf ej                  g ddgd
gg      g fg      	 	 	 	 dd       Z
ej
                  j                  d ej                  ddgddgg      g f ej                  dgddgdd
gg      g f ej                  ddgddgddgd
dgg      g f ej                  ddgddgdd
gg      d
gf ej                  ddgddgd
gdgg      d
dgf ej                  dgddgdd
gddgg      dgf ej                  dgdgddgd
dgdgg      dgf ej                  ddgddgdd
gddgddgg      ddgf ej                  dgdgddgd
dgdgdgg      ddgf ej                  g dg      g f ej                  dgg dg      g f ej                  g ddgd
gg      dd
gfg      	 	 	 	 dd       Zy)Describe_SubtableParserzJUnit-test suite for `unstructured.partition.xlsx._SubtableParser` objects.)r  r   r   r   r   r   r   r(   r   rV   )r   r(   r&   r&   NrC   )r   r(   r&   r   r   rD   )r   r(   r&   r   r'   r   )r   r(   r&   r   r'   r   r   )r   r   r   c                f    t        |      }|j                  }|J t        j                  ||       y)zQcore-table is correctly distinguished from leading and trailing single-cell rows.N)r   
core_tabler  r  )r   r  r   subtable_parserr  s        r"   *it_extracts_the_core_table_from_a_subtablezBDescribe_SubtableParser.it_extracts_the_core_table_from_a_subtable  s6    X *(3$//
%%%z>:r8   c                Z    t        |      }t        |j                               }||k(  sJ y r   )r   list#iter_leading_single_cell_rows_texts)r   r  r   r  leading_single_cell_row_textss        r"   8it_extracts_the_leading_single_cell_rows_from_a_subtablezPDescribe_SubtableParser.it_extracts_the_leading_single_cell_rows_from_a_subtable)  s0    ( *(3(,_-`-`-b(c%,>>>r8   c                Z    t        |      }t        |j                               }||k(  sJ y r   )r   r  $iter_trailing_single_cell_rows_texts)r   r  r   r  trailing_single_cell_row_textss        r"   9it_extracts_the_trailing_single_cell_rows_from_a_subtablezQDescribe_SubtableParser.it_extracts_the_trailing_single_cell_rows_from_a_subtableA  s5    . *(3)-@@B*
& .???r8   )r  pd.DataFramer   r  )r   r   r   r   rH   r   r   r   r   r  r  r  rK   r8   r"   r  r    s   T[[& sCj3*5aVDsCj3*5aVD sec3Z#s<INsCj3*5aVD C[4+SzC:Fl sCj3*5aVD	 sCj3*tSkB)TsCj3*5aVD sCj3*secUC<XsCj3*5aVD sec3Z#sdC[IQ]^sCj3*5aVD secUS#Jc
SEJRabsCj3*5aVD C[3*sCj4+c{S) sCj3*5aVD USEC:SzC53%HPb sCj3*5aVD	 o.qc:o.qc: se_5aVDo.qc: ouse<INo.qc:AD	
GP	;$	;6B	;QGP	; [[&R\\C:Sz23R8R\\C53*sCj9:SEBR\\D#;sc3Z#sLMPSUXzZR\\C:SzD#;?@"ER\\C:SzC53%@A2FR\\C53*sCj4+FG#OR\\C53%#sc3Z#GH3PS*UR\\D#;c
S#JsdTW[YZ]`\abR\\C53%#sc3Z#NORUWZQ[\R\\?+,b1R\\C5/23cU;R\\?SEC59:B?	
"?$?6B?#"? [[&R\\C:Sz23R8R\\C53*sCj9:B?R\\D#;sc3Z#sLMrRR\\C:SzD#;?@3%HR\\C:SzC53%@AC:NR\\C53*sCj4+FG#OR\\C53%#sc3Z#GH3%PtSkC:SzD#;QUWZP[\]c
 R\\C53%#sc3Z#NORUWZQ[\R\\?+,b1R\\C5/23R8R\\?SEC59:S#JG	
(	@$	@6B	@)(	@r8   r  )rS   r   )r~   r   )Cr   
__future__r   rh   r   r>   typingr   pandasr   pandas.testingtestingr  rH   pytest_mockr   *test_unstructured.partition.test_constantsr   r   r   test_unstructured.unit_utilsr	   r
   r   r   r   unstructured.cleaners.corer   unstructured.documents.elementsr   r   r   r   unstructured.partition.xlsxr   r   r   r   r1   r3   r7   rE   rL   rR   r   r   rZ   ra   re   rk   rn   rq   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  rK   r8   r"   <module>r%     s"   ? " 	 
      % 
  > H H  X # @B
	3 04-@
M A
M/1@"3/WCUU.
5$N5
3"
B0\
 \
~ 
  
FK@ K@r8   