
    z%i                     t    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                   `    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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        G/home/uftp/.pyenv/versions/3.12.0/lib/python3.12/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_repeat3   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_hash@   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_cmpD   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_fieldsN   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_constructorT   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   ExcrJ   a   s    r   rO   c                       e Zd Z fdZd Zy)'StructSeqTest.test_eviltuple.<locals>.Cc                     r%   rN   )r   r   rO   s     r   r   z3StructSeqTest.test_eviltuple.<locals>.C.__getitem__f   s    	r   c                      y)N	   rN   )r   s    r   __len__z/StructSeqTest.test_eviltuple.<locals>.C.__len__h   s    r   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`   s5    	) 		 	 	#t//5r   c                 L    t        j                         }|j                         }y r%   )r   r   
__reduce__)r   r   xs      r   test_reducezStructSeqTest.test_reducem   s    KKMLLNr   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_getsliceq   s|    KKMG= 	9E 9#ABK 9D$$T!E$tO*<%=%&uT$%7999	9r   c                 \    d}| j                  t        j                  j                  |       y )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8-Hr   c                     d}| j                  t        j                  j                  d       | j                  t        j                  j                  |       y )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   s=    .88!<66Fr   N)rK   rL   rM   r   r#   r)   r-   r1   r4   r7   r=   rG   rX   r\   rg   ru   r   rN   r   r   r   r      sJ    /,&35"4(<
+6
9I
Gr   r   __main__)r   r   unittestTestCaser   rK   mainrN   r   r   <module>r      s?    	  @GH%% @GF zHMMO r   