o
    GgO                     @   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   rfnZrecursive_fill_fieldsr   ndarraytuplevoid)about r   jC:\Users\micha\Documents\internet-seite\env\Lib\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namesZadtyper   r   r   test_get_names      ""r&   c                  C   r   r   )r   Z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   Zflatten_descrr   strr   ndtyper   r   r   test_flatten_descr'   s   &r-   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	   ZB_AB_BZB_B_AZB_B_B)	r   r   r   r   r   Zget_fieldstructuredictr*   listr+   r   r   r   test_get_fieldstructure,   s
    r1   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   Zmerge_arraysr   onesr   int_r   recarrayr   r   r   r   r   r   r   test_merge_arrays4   s   r5   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)Z
asrecarray)r   r   doubler2   r   r   r   Zdrop_fieldsr   r   r   r   Zrecr4   Zrec_drop_fieldsr,   r   r   r   r   test_drop_fields>   s   "

r8   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   r.   )r   r    )r   r   r6   r2   r   r   r   Zrename_fieldsr   r   r   r   r7   r   r   r   test_rename_fieldsP   s   "r9   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   Zrepack_fieldsr   typer2   r   r   r   )dtr   r   r   test_repack_fieldsZ   s   r=   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   Zstructured_to_unstructurednptNDArrayr   r   r   r   r   test_structured_to_unstructurede   s   rG   c                  C   sB   t g d} t jdt jdd}tt|| tj	t j
  d S )Nr?      r
   )r>      )r   r   Zarangeint32Zreshaper   r   unstructured_to_structuredrD   rE   r   )r<   r   r   r   r   rK   j   s   rK   c                  C   @   t jdg dd} ttt j| t jtt t j	t j
 f  d S Nr>   ))xrA   )yrC   )zf8r
   r   r2   r   r   Zapply_along_fieldsmeanr   r   r   r   r   r   r   r   r   test_apply_along_fieldsp   
   rU   c                  C   rL   rM   rR   rT   r   r   r   test_assign_fields_by_namex   rV   rW   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 )Nr>   )r@   )r   rQ   rB   u1r
   )r   rC   rX   )
r   r2   r   r   Zrequire_fieldsr   r   r   r   r   rF   r   r   r   test_require_fields   s
   rZ   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   rJ   r   r   Zstack_arraysr   r   r   r2   r#   r   maMaskedArrayr   )rN   rP   zzr   r   r   test_stack_arrays   s   $r_   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)Z
ignoremaskZreturn_index)r   r   r   r\   r2   viewr   r   Zfind_duplicatesr]   r   r   r   r   r3   r7   r   r   r   test_find_duplicates   s   $rc   )r   N)__doc__typingr   Ztyping_extensionsr   numpyr   Znumpy.typingrD   Z	numpy.libr   r   r   r&   r(   r-   r1   r5   r8   r9   r=   rG   rK   rU   rW   rZ   r_   rc   r   r   r   r   <module>   s,    



	
	












