
    <e                     r    d dl Z d dlZd dlZ G d dej                  Zedk    r ej                     dS dS )    Nc                   b    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd ZdS )StructSeqTestc                 j   t          j                    }|                     |t                     t          |          }|                     t          |          t          |                     |                     ||           t          t          |           t          |                    D ]|}|                     ||d          ||d                     t          t          |           t          |                    D ](}|                     |||         |||                    )}t          t          |           t          |                    D ](}|                     |d |         |d |                    )|                     t          |j	        t          |           dz
             |                     t          |j	        t          |                     t          t          |           t          |          dz
            D ]$}|                     ||         ||                    %d S )N   )
timegmtimeassertIsInstancetupleassertEquallenrangeassertRaises
IndexError__getitem__)selftastupleijs        */usr/lib/python3.11/test/test_structseq.py
test_tuplezStructSeqTest.test_tuple   s   KMMa'''((QW...G$$$ AwA'' 	7 	7AQqrrUGABBK000CFF7CFF++ 7 7  1Q3166667 AwA'' 	1 	1AQrrUGBQBK0000*amc!ffWQY???*amSVV<<<AwAq)) 	/ 	/AQqT71:....	/ 	/    c                    t          j                    }|                     t          |                     t          j        d          }|                     t          |          d           t          j        t                    }t          |          }|                     |                    d                     | 	                    d|           | 	                    d|           | 	                    d|           d S )Nr   zttime.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)zos.stat_resultzst_mode=zst_ino=zst_dev=)
r   r   
assertTruereprr   osstat__file__
startswithassertIn)r   r   streps       r   	test_reprzStructSeqTest.test_repr   s    KMMQ   KNNaD	E 	E 	E WX2hh'788999j#&&&i%%%i%%%%%r   c           	          t          j                    }|t          |          z   }t          t	          |                    D ]4}|                     ||         ||t	          |          z                       5d S N)r   r   r
   r   r   r   r   t1t2r   s       r   test_concatzStructSeqTest.test_concat-   sl    []]%))^s2ww 	3 	3ARUBqRyM2222	3 	3r   c           
      B   t          j                    }d|z  }t          t          |                    D ]i}|                     ||         ||t          |          z                       |                     ||         ||dt          |          z  z                       jd S )N      )r   r   r   r   r   r&   s       r   test_repeatzStructSeqTest.test_repeat3   s    []]Vs2ww 	5 	5ARUBqRyM222RUBq3r77{O4444	5 	5r   c                     t          j                    }|D ]}|                     ||           |                     d|           d S )Ni)r   r   r    assertNotIn)r   r'   items      r   test_containszStructSeqTest.test_contains:   sO    []] 	$ 	$DMM$####b!!!!!r   c                     t          j                    }|                     t          |          t          t	          |                               d S r%   )r   r   r   hashr
   )r   r'   s     r   	test_hashzStructSeqTest.test_hash@   s;    []]b4b		??33333r   c                    t          j                    } t          |          |          }|                     ||           |                     ||k                 |                     ||k               |                     ||k                |                     ||k               |                     ||k                d S r%   )r   r   typer   r   )r   r'   r(   s      r   test_cmpzStructSeqTest.test_cmpD   s    []]T"XXb\\R   R"W&&&b!!!R"W&&&b!!!R2X'''''r   c                     t          j                    }|                     t          |          |j                   |                     |j        d           |                     |j        t           j                   d S )Nr   )r   r   r   r   n_sequence_fieldsn_unnamed_fieldsn_fields_STRUCT_TM_ITEMS)r   r   s     r   test_fieldszStructSeqTest.test_fieldsN   sf    KMMQ!4555+Q///T%:;;;;;r   c                    t           j        }|                     t          |           |                     t          |d            |                     t          |d           |                     t          |di            |                     t          |dd            d}|                     d                     ||                    |           d S )N123)dict	123456789 )r   struct_timer   	TypeErrorr   join)r   r   ss      r   test_constructorzStructSeqTest.test_constructorT   s    )Q''')Q---)Q...)QB777)Q$???1*****r   c                      G d dt                      G fdd          }|                     t          j         |                       d S )Nc                       e Zd ZdS ))StructSeqTest.test_eviltuple.<locals>.ExcN)__name__
__module____qualname__ r   r   ExcrJ   a   s        Dr   rO   c                        e Zd Z fdZd ZdS )'StructSeqTest.test_eviltuple.<locals>.Cc                     r%   rN   )r   r   rO   s     r   r   z3StructSeqTest.test_eviltuple.<locals>.C.__getitem__f   s    	r   c                     dS )N	   rN   )r   s    r   __len__z/StructSeqTest.test_eviltuple.<locals>.C.__len__h   s    qr   N)rK   rL   rM   r   rU   )rO   s   r   CrQ   e   s=                r   rV   )	Exceptionr   r   rC   )r   rV   rO   s     @r   test_eviltuplezStructSeqTest.test_eviltuple`   s    	 	 	 	 	) 	 	 		 	 	 	 	 	 	 	 	 	 	#t/55555r   c                 T    t          j                    }|                                }d S r%   )r   r   
__reduce__)r   r   xs      r   test_reducezStructSeqTest.test_reducem   s    KMMLLNNr   c                     t          j                    }t          |          }d}|D ]I}|D ]D}|dd          D ]7}|                     t          ||||                   ||||                    8EJd S )N)
r   Nr   r+      i,  iir   )r   r   listr   )r   r   Lindicesstartstopsteps          r   test_extended_getslicez$StructSeqTest.test_extended_getsliceq   s    KMMGG= 	9 	9E 9 9#ABBK 9 9D$$T!E$tO*<%=%=%&uT$%79 9 9 999	9 	9r   c                 T    d}|                      t          j        j        |           d S )N)	tm_yeartm_montm_mdaytm_hourtm_mintm_sectm_wdaytm_ydaytm_isdst)r   r   rC   __match_args__r   expected_argss     r   test_match_argszStructSeqTest.test_match_args}   s,    E)8-HHHHHr   c                     d}|                      t          j        j        d           |                      t          j        j        |           d S )N)st_modest_inost_devst_nlinkst_uidst_gidst_sizer+   )r   r   stat_resultr:   rr   rs   s     r   #test_match_args_with_unnamed_fieldsz1StructSeqTest.test_match_args_with_unnamed_fields   sE    .8!<<<6FFFFFr   N)rK   rL   rM   r   r#   r)   r-   r1   r4   r7   r=   rG   rX   r\   rg   ru   r   rN   r   r   r   r      s        / / /,& & &3 3 35 5 5" " "4 4 4( ( (< < <
+ 
+ 
+6 6 6  
9 
9 
9I I I
G G G G Gr   r   __main__)r   r   unittestTestCaser   rK   mainrN   r   r   <module>r      s    				  @G @G @G @G @GH% @G @G @GF zHMOOOOO r   