
    6\h                         d dl Z d dlZ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                   t    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 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        =/opt/python-3.11.14/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_repeat5   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_hashB   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_cmpF   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_fieldsP   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_constructorV   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   ExcrK   c   s        Dr   rP   c                        e Zd Z fdZd ZdS )'StructSeqTest.test_eviltuple.<locals>.Cc                     r&   rO   )r   r   rP   s     r   r   z3StructSeqTest.test_eviltuple.<locals>.C.__getitem__h   s    	r   c                     dS )N	   rO   )r   s    r   __len__z/StructSeqTest.test_eviltuple.<locals>.C.__len__j   s    qr   N)rL   rM   rN   r   rV   )rP   s   r   CrR   g   s=                r   rW   )	Exceptionr   r   rD   )r   rW   rP   s     @r   test_eviltuplezStructSeqTest.test_eviltupleb   s    	 	 	 	 	) 	 	 		 	 	 	 	 	 	 	 	 	 	#t/55555r   c                    t          j                    }t          t          j        dz             D ]}t          j        ||          }t          j        |          }|                     |j        |j                   |                     ||           |                     |j	        |j	                   |                     |j
        |j
                   d S r   )r   r	   r   pickleHIGHEST_PROTOCOLdumpsloadsr   	__class__tm_yeartm_zone)r   r   protopr)   s        r   test_picklingzStructSeqTest.test_picklingo   s    KMM62Q677 	4 	4EQ&&AaBR\1;777R###RZ333RZ3333	4 	4r   c                 X   t           j        j        dk    sJ t          j        t          t           j        j                  ddd          }t          t
          j        dz             D ]}t          j        ||          }t          j        |          }| 	                    |j
        |j
                   | 	                    ||           | 	                    |j        |j                   | 	                    |j        |j                   | 	                    |j        |j                   d S )Nr         ?       @st_atimest_atime_nsr   )r   stat_resultr;   r   r:   r[   r\   r]   r^   r   r_   st_moderi   rj   )r   rrb   rc   r2s        r   !test_pickling_with_unnamed_fieldsz/StructSeqTest.test_pickling_with_unnamed_fieldsy   s   ~.2222N5!ABB(+C@@B B62Q677 	< 	<EQ&&AaBR\1;777R###RZ333R[!*555R^Q];;;;	< 	<r   c                    t           j        j        }t          j        d t          |          D                       }t	          j        |          }|                     |j        |j                   |                     ||           |                     |j        |j                   |                     |j        |j                   | 	                    |d         |d                    | 	                    |j        |j                   t	          j
        |          }|                     |j        |j                   |                     ||           |                     |j        |j                   |                     |j        |j                   |                     |d         |d                    |                     |j        |j                   d S )Nc                     g | ]}|gS rO   rO   .0r   s     r   
<listcomp>z.StructSeqTest.test_copying.<locals>.<listcomp>   s    ;;;aqc;;;r   r   )r   rD   r<   r   copyr   r_   r`   ra   assertIsdeepcopyassertIsNot)r   r<   r   r)   t3s        r   test_copyingzStructSeqTest.test_copying   s   #,;;5??;;;<<Yq\\q{333QQY///QY///beQqT"""bj!),,,]1q{333QQY///QY///A!%%%QY/////r   c                 h   t           j        j        dk    sJ t           j        j        }t          j        d t	          |          D             dgdgd          }t          j        |          }|                     |j        |j                   |                     ||           |                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |d         |d                    |                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   t          j        |          }|                     |j        |j                   |                     ||           |                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |d         |d                    |                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   d S )Nr   c                     g | ]}|gS rO   rO   rr   s     r   rt   zBStructSeqTest.test_copying_with_unnamed_fields.<locals>.<listcomp>   s    BBBAQCBBBr   rf   rg   rh   )r   rk   r;   r:   r   ru   r   r_   rl   ri   rj   rv   rw   rx   )r   r:   rm   rn   r3s        r    test_copying_with_unnamed_fieldsz.StructSeqTest.test_copying_with_unnamed_fields   sO   ~.2222N<NBB/@)A)ABBB),seDDF F Yq\\q{333QQY///aj111777beQqT"""bj!),,,bk1:...bnam444]1q{333QQY///aj111777A!%%%QY///aj11177777r   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_getslice   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)	r`   tm_montm_mdaytm_hourtm_mintm_sectm_wdaytm_ydaytm_isdst)r   r   rD   __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)rl   st_inost_devst_nlinkst_uidst_gidst_sizer,   )r   r   rk   r;   r   r   s     r   #test_match_args_with_unnamed_fieldsz1StructSeqTest.test_match_args_with_unnamed_fields   sE    .8!<<<6FFFFFr   N)rL   rM   rN   r   r$   r*   r.   r2   r5   r8   r>   rH   rY   rd   ro   rz   r~   r   r   r   rO   r   r   r   r      s       / / /,& & &3 3 35 5 5" " "4 4 4( ( (< < <
+ 
+ 
+6 6 64 4 4< < <0 0 0(8 8 8:
9 
9 
9I I I
G G G G Gr   r   __main__)	ru   r   r[   r   unittestTestCaser   rL   mainrO   r   r   <module>r      s     				   EG EG EG EG EGH% EG EG EGP zHMOOOOO r   