
    daf                         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                          yy)    Nc                   r    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y)StructSeqTestc                 p   t        j                         }| j                  |t               t        |      }| j	                  t        |      t        |             | j	                  ||       t        t        |       t        |            D ]V  }| j	                  ||d  ||d         t        t        |       t        |            D ]  }| j	                  ||| |||         X t        t        |       t        |            D ]  }| j	                  |d | |d |         | j                  t        |j                  t        |       dz
         | j                  t        |j                  t        |             t        t        |       t        |      dz
        D ]  }| j	                  ||   ||           y N   )
timegmtimeassertIsInstancetupleassertEquallenrangeassertRaises
IndexError__getitem__)selftastupleijs        ./root/Python-3.12.4/Lib/test/test_structseq.py
test_tuplezStructSeqTest.test_tuple
   s~   KKMa'(QW.G$ AwA' 	7AQqrUGABK0CF7CF+ 7  1Q167	7
 AwA' 	1AQrUGBQK0	1 	*ammc!fWQY?*ammSV<AwAq) 	/AQqT71:.	/    c                    t        j                         }| j                  t        |             t        j                  d      }| j	                  t        |      d       t        j                  t              }t        |      }| j                  |j                  d             | j                  d|       | j                  d|       | j                  d|       y )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    KKMQ KKNaD	E WWX2h'789j#&i%i%r   c           	          t        j                         }|t        |      z   }t        t	        |            D ]&  }| j                  ||   ||t	        |      z             ( y N)r   r	   r   r   r   r   r   t1t2r   s       r   test_concatzStructSeqTest.test_concat/   sQ    [[]%)^s2w 	3ARUBqRyM2	3r   c           
          t        j                         }d|z  }t        t        |            D ]M  }| j	                  ||   ||t        |      z             | j	                  ||   ||dt        |      z  z             O y )N      )r   r	   r   r   r   r'   s       r   test_repeatzStructSeqTest.test_repeat5   sq    [[]Vs2w 	5ARUBqRyM2RUBq3r7{O4	5r   c                     t        j                         }|D ]  }| j                  ||        | j                  d|       y )Ni)r   r	   r!   assertNotIn)r   r(   items      r   test_containszStructSeqTest.test_contains<   s:    [[] 	$DMM$#	$b!r   c                     t        j                         }| j                  t        |      t        t	        |                   y r&   )r   r	   r   hashr   )r   r(   s     r   	test_hashzStructSeqTest.test_hashB   s)    [[]b4b	?3r   c                 @   t        j                         } t        |      |      }| j                  ||       | j	                  ||k          | j	                  ||k         | j	                  ||kD          | j	                  ||k\         | j	                  ||k7          y r&   )r   r	   typer   r   )r   r(   r)   s      r   test_cmpzStructSeqTest.test_cmpF   s    [[]T"Xb\R R"W&b!R"W&b!R2X'r   c                    t        j                         }| j                  t        |      |j                         | j                  |j
                  d       | j                  |j                  t         j                         y 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   sW    KKMQ!4!45++Q/T%:%:;r   c                 b   t         j                  }| j                  t        |       | j                  t        |d        | j                  t        |d       | j                  t        |di        | j                  t        |dd        d}| j	                  dj                   ||            |       y )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)Q$?1*r   c                      G d dt                G fdd      }| j                  t        j                   |              y )Nc                       e Zd Zy))StructSeqTest.test_eviltuple.<locals>.ExcN)__name__
__module____qualname__ r   r   ExcrL   c   s    r   rQ   c                       e Zd Z fdZd Zy)'StructSeqTest.test_eviltuple.<locals>.Cc                     r&   rP   )r   r   rQ   s     r   r   z3StructSeqTest.test_eviltuple.<locals>.C.__getitem__h   s    	r   c                      y)N	   rP   )r   s    r   __len__z/StructSeqTest.test_eviltuple.<locals>.C.__len__j   s    r   N)rM   rN   rO   r   rW   )rQ   s   r   CrS   g   s    r   rX   )	Exceptionr   r   rE   )r   rX   rQ   s     @r   test_eviltuplezStructSeqTest.test_eviltupleb   s5    	) 		 	 	#t//5r   c                    t        j                         }t        t        j                  dz         D ]  }t        j
                  ||      }t        j                  |      }| j                  |j                  |j                         | j                  ||       | j                  |j                  |j                         | j                  |j                  |j                          y 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    KKM622Q67 	4EQ&AaBR\\1;;7R#RZZ3RZZ3	4r   c                    t         j                  j                  dkD  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                  |j                  |j                         | j                  |j                  |j                          y )Nr         ?       @st_atimest_atime_nsr   )r   stat_resultr<   r   r;   r\   r]   r^   r_   r   r`   st_moderj   rk   )r   rrc   rd   r2s        r   !test_pickling_with_unnamed_fieldsz/StructSeqTest.test_pickling_with_unnamed_fieldsy   s    ~~..222NN5!A!AB(+C@B622Q67 	<EQ&AaBR\\1;;7R#RZZ3R[[!**5R^^Q]];	<r   c                    t         j                  j                  }t        j                  t        |      D cg c]  }|g c}      }t	        j                  |      }| j                  |j                  |j                         | j                  ||       | j                  |j                  |j                         | j                  |j                  |j                         | j                  |d   |d          | j                  |j                  |j                         t	        j                  |      }| j                  |j                  |j                         | j                  ||       | j                  |j                  |j                         | j                  |j                  |j                         | j                  |d   |d          | j                  |j                  |j                         y c c}w r:   )r   rE   r=   r   copyr   r`   ra   rb   assertIsdeepcopyassertIsNot)r   r=   r   r   r)   t3s         r   test_copyingzStructSeqTest.test_copying   s`   ##,,5?;aqc;<YYq\q{{3QQYY/QYY/beQqT"bjj!)),]]1q{{3QQYY/QYY/A!%QYY/! <s   
G7c                 
   t         j                  j                  dkD  sJ t         j                  j                  }t        j                  t	        |      D cg c]  }|g c}dgdgd      }t        j
                  |      }| j                  |j                  |j                         | j                  ||       | j                  |j                  |j                         | j                  |j                  |j                         | j                  |j                  |j                         | j                  |d   |d          | j                  |j                  |j                         | j                  |j                  |j                         | j                  |j                  |j                         t        j                  |      }| j                  |j                  |j                         | j                  ||       | j                  |j                  |j                         | j                  |j                  |j                         | j                  |j                  |j                         | j                  |d   |d          | j                  |j                  |j                         | j                  |j                  |j                         | j                  |j                  |j                         y c c}w )Nr   rg   rh   ri   )r   rl   r<   r;   r   rr   r   r`   rm   rj   rk   rs   rt   ru   )r   r;   r   rn   ro   r3s         r    test_copying_with_unnamed_fieldsz.StructSeqTest.test_copying_with_unnamed_fields   s   ~~..222NN<<NN/@)ABAQCB),seDF YYq\q{{3QQYY/ajj17beQqT"bjj!)),bkk1::.bnnamm4]]1q{{3QQYY/ajj17A!%QYY/ajj17/ Cs   
L c                     t        j                         }t        |      }d}|D ]:  }|D ]3  }|dd  D ])  }| j                  t        ||||         ||||          + 5 < y )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|    KKMG= 	9E 9#ABK 9D$$T!E$tO*<%=%&uT$%7999	9r   c                 \    d}| j                  t        j                  j                  |       y )N)	ra   tm_montm_mdaytm_hourtm_mintm_sectm_wdaytm_ydaytm_isdst)r   r   rE   __match_args__r   expected_argss     r   test_match_argszStructSeqTest.test_match_args   s&    E))88-Hr   c                     d}| j                  t        j                  j                  d       | j                  t        j                  j                  |       y )N)rm   st_inost_devst_nlinkst_uidst_gidst_sizer,   )r   r   rl   r<   r   r   s     r   #test_match_args_with_unnamed_fieldsz1StructSeqTest.test_match_args_with_unnamed_fields   s=    .88!<66Fr   N)rM   rN   rO   r   r$   r*   r.   r2   r5   r8   r?   rI   rZ   re   rp   rw   rz   r   r   r   rP   r   r   r   r      sY    /,&35"4(<
+64<0(8:
9I
Gr   r   __main__)	rr   r   r\   r   unittestTestCaser   rM   mainrP   r   r   <module>r      sE     	   EGH%% EGP zHMMO r   