o
    %g                     @   s   d Z ddlmZ ddlmZ ddlZddlmZ ddl	m
Z d'ddZd'd	d
Zd'ddZd'ddZd'ddZd'ddZd'ddZd'ddZd'ddZd'ddZd'ddZd'ddZd'dd Zd'd!d"Zd'd#d$Zd'd%d&ZdS )(zGThese tests are based on the doctests from `numpy/lib/recfunctions.py`.    )Any)assert_typeN)recfunctionsreturnc                  C   sh   t jddgdt jfdt jfgd} t jtdf| jd}t| |}t	|t j
tt t jt j f  d S )N)   g      $@)   g      4@ABdtype   )nparrayint64float64zerosintr   rfnrecursive_fill_fieldsr   ndarraytuplevoid)about r   h/root/parts/websockify/install/lib/python3.10/site-packages/numpy/typing/tests/data/pass/recfunctions.pytest_recursive_fill_fields   s   $r   c                  C   n   t tjddtfgdj} t tjddtfdtfgdj} tdtfddtfdtfgfg}t |} d S 	N)r   r   r
   r	   r   r   b_ab_b)r   	get_namesr   emptyr   r   floatnamesadtyper   r   r   test_get_names      ""r(   c                  C   r   r   )r   get_names_flatr   r#   r   r   r$   r%   r   r   r   test_get_names_flat   r)   r+   c                  C   s<   t ddddgfg} tt| tttt jt f   d S )N)r   <i4r   )r    z<f8)r!   r,   )r   r   r   r   flatten_descrr   strr   ndtyper   r   r   test_flatten_descr'   s   &r1   c               	   C   sN   t dtfddtfddtfdtfgfgfg} tt| tttt f  d S )Nr   r	   B_AB_BB_B_AB_B_B)	r   r   r   r   r   get_fieldstructuredictr.   listr/   r   r   r   test_get_fieldstructure,   s
    r9   c                   C   sN   t tttdftjttdftjftjt	t tj
tj f  d S )Nr   r   )r   r   merge_arraysr   onesr   int_r   recarrayr   r   r   r   r   r   r   test_merge_arrays4   s   r>   c                  C   s   dt jfddt jfdt jfgfg} t jtdf| d}tt|dt jt	t t j
t j f  ttj|dddt jjt	t t j
t j f  tt|dt jjt	t t j
t j f  d S )	Nr   r   r    r!   r   r
   T)
asrecarray)r   r   doubler;   r   r   r   drop_fieldsr   r   r   r   recr=   rec_drop_fieldsr0   r   r   r   r   test_drop_fields>   s   "

rE   c                  C   sh   dt jfddt jfdt jfgfg} t jtdf| d}tt|ddd	t jt	t t j
t j f  d S )
Nr   r   r    r!   r   r
   r   r3   )r   r!   )r   r   r@   r;   r   r   r   rename_fieldsr   r   r   r   rD   r   r   r   test_rename_fieldsP   s   "rG   c                  C   sx   t jddd} tt| t jt j  tt| dt j ttt jtdf| dt j	t
t t jt j f  d S )Nzu1, <i8, <f8T)alignr   r   r
   )r   r   r   r   repack_fieldsr   typer;   r   r   r   )dtr   r   r   test_repack_fieldsZ   s   rL   c                  C   s,   t jdg dd} tt| tjt  d S )N   r   i4)r   zf4,u2)cf4r   r
   )r   r   r   r   structured_to_unstructurednptNDArrayr   r   r   r   r   test_structured_to_unstructurede   s   rW   c                  C   sB   t g d} t jdt jdd}tt|| tj	t j
  d S )NrN      r
   )rM      )r   r   arangeint32reshaper   r   unstructured_to_structuredrT   rU   r   )rK   r   r   r   r   r]   j   s   r]   c                  C   @   t jdg dd} ttt j| t jtt t j	t j
 f  d S NrM   ))xrP   )yrR   )zf8r
   r   r;   r   r   apply_along_fieldsmeanr   r   r   r   r   r   r   r   r   test_apply_along_fieldsp   
   rh   c                  C   r^   r_   rd   rg   r   r   r   test_assign_fields_by_namex   ri   rj   c                  C   sB   t jdg dd} tt| ddgt jtt t jt j	 f  d S )NrM   )rO   )r   rc   rQ   u1r
   )r   rR   rk   )
r   r;   r   r   require_fieldsr   r   r   r   r   rV   r   r   r   test_require_fields   s
   rn   c                  C   s   t tdft j} tt| t jtt t j	t j f  t 
tdfddtfg}t 
tdfddt jfdt jfg}tt||ft jjttdf t j	t j f  d S )Nr   )r   z|S3r	   C.)r   r   r   r[   r   r   stack_arraysr   r   r   r;   r$   r   maMaskedArrayr   )r`   rb   zzr   r   r   test_stack_arrays   s   $rt   c                  C   s   t dtfg} t jjdg dd| }tt|t jj	t
t jt j f  ttj|dddtt jj	t
t jt j f t jt
t jt j f f  d S )Nr      )r   r   r   r   r   r   r   )maskT)
ignoremaskreturn_index)r   r   r   rq   r;   viewr   r   find_duplicatesrr   r   r   r   r   r<   rD   r   r   r   test_find_duplicates   s   $r{   )r   N)__doc__typingr   typing_extensionsr   numpyr   numpy.typingrT   	numpy.libr   r   r   r(   r+   r1   r9   r>   rE   rG   rL   rW   r]   rh   rj   rn   rt   r{   r   r   r   r   <module>   s,    



	
	












