o
    tBh                     @   sN   d dl Z d dlZd dlmZ d dlmZ edg dddgZG dd	 d	ZdS )
    N)assert_equal)_make_tuple_bunchResult)xyzwbetac                   @   sz  e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zejd%d&d'gd(gfd)d*gd+gfd)d'gd,gfgd-d. Zejd%d)g d/d+gfd)d'd(gd(d+gfgd0d1 Zejd%d)d2gd+gfd)d'gd3gfgd4d5 Zejd%d)d6gd+gfd)d'gd7gfd8d'gd+gfgd9d: Zd;d< Zd=S )>TestMakeTupleBunchc                 C   s   t dddddd| _d S )N         c         ?r   r   r   r   r	   )r   resultself r   r/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/scipy/_lib/tests/test_bunch.pysetup   s   zTestMakeTupleBunch.setupc                 C   sJ   t | jjd t | jjd t | jjd t | jjd t | jjd d S )Nr   r   r   r   r   )r   r   r   r   r   r   r	   r   r   r   r   test_attribute_access   s
   z(TestMakeTupleBunch.test_attribute_accessc                 C   s~   t | jd d t | jd d t | jd d t | jd d tjtdd | jd  W d    d S 1 s8w   Y  d S )Nr   r   r   r   zindex out of rangematch)r   r   pytestraises
IndexErrorr   r   r   r   test_indexing   s   "z TestMakeTupleBunch.test_indexingc                 C   s,   | j \}}}t|||fd t| j d d S Nr   r   r   )r   r   )r   x0y0z0r   r   r   test_unpacking&   s   z!TestMakeTupleBunch.test_unpackingc                 C   sD   t | jdd  d t | jd d d d t | jd d d d d S )Nr   )r   r   r   )r   r   r   )r   r   r   )r   r   r   r   r   r   
test_slice+   s   zTestMakeTupleBunch.test_slicec                 C   s   t t| jd d S )Nr   )r   lenr   r   r   r   r   test_len0   s   zTestMakeTupleBunch.test_lenc                 C   s   t | j}t|d d S )Nz%Result(x=1, y=2, z=3, w=99, beta=0.5))reprr   r   )r   sr   r   r   	test_repr3   s   
zTestMakeTupleBunch.test_reprc                 C   s   t t| jtd d S r   )r   hashr   r   r   r   r   	test_hash7   s   zTestMakeTupleBunch.test_hashc                 C   sx   t | j}t |}t|tsJ t|j| jj t|j| jj t|j	| jj	 t|j
| jj
 t|j| jj d S )N)pickledumpsr   loads
isinstancer   r   r   r   r   r   r	   )r   r)   objr   r   r   test_pickle:   s   
zTestMakeTupleBunch.test_picklec                 C   <   t jtdd d| j_W d    d S 1 sw   Y  d S )Ncan't set attributer   r   )r   r   AttributeErrorr   r   r   r   r   r   test_read_only_existingD      
"z*TestMakeTupleBunch.test_read_only_existingc                 C   r3   )Nr4   r   zlattice of coincidence)r   r   r5   r   plate_of_shrimpr   r   r   r   test_read_only_newH   r7   z%TestMakeTupleBunch.test_read_only_newc                 C   sD   t jtdd tddddd W d    d S 1 sw   Y  d S )Nmissingr   r   r   r         ?)r   r   r   r	   r   r   	TypeErrorr   r   r   r   r   "test_constructor_missing_parameterL   s   "z5TestMakeTupleBunch.test_constructor_missing_parameterc              	   C   sH   t jtdd tddddddd	 W d    d S 1 sw   Y  d S )
N
unexpectedr   r   r   r   {   r;   i  )r   r   r   r   r	   foor<   r   r   r   r   $test_constructor_incorrect_parameterQ   s   "z7TestMakeTupleBunch.test_constructor_incorrect_parameterc                 C   s"   d}t tj| t | jj| d S )Nzscipy._lib.tests.test_bunch)r   r   
__module__r   )r   mr   r   r   test_moduleV   s   zTestMakeTupleBunch.test_modulec                 C   s|   t dddddd}t ddd	d
dd}t|jd t|jd t|d d  d t|jd
 t|jd t|d d  d d S )Nr   r   r   r   g        r            r   g      ?r    )rF   rG   rH   )r   r   r   r	   )r   result1result2r   r   r   test_extra_fields_per_instance[   s   z1TestMakeTupleBunch.test_extra_fields_per_instancec                 C   sH   t dddg}|ddd}t|jd t|jd t|}t|d d S )NSquarewidthheightr   r   )rM   rN   zSquare(width=1, height=2))r   r   rM   rN   r(   )r   rL   sqr)   r   r   r   "test_extra_field_names_is_optionaln   s   z5TestMakeTupleBunch.test_extra_field_names_is_optionalc                 C   s>   t dddg}|ddd}t|tsJ t|d tsJ d S )NTupabr   r   )rR   rS   )r   )r   r0   tuple)r   rQ   tur   r   r   test_tuple_likev   s   z"TestMakeTupleBunch.test_tuple_likec                 C   sD   d}t ddgddg|d}|ddd	d
}t|j| t|j| d S )Nzsome.module.nameFoor   rR   rS   )moduler   ic  q   )r   rR   rS   )r   r   rC   )r   rD   rW   rA   r   r   r   test_explicit_module|   s
   z'TestMakeTupleBunch.test_explicit_moduleargs123rR   rS   rW   z-3r   z+-*/c                 C   <   t jtdd t|  W d    d S 1 sw   Y  d S )Nidentifiersr   r   r   
ValueErrorr   r   r[   r   r   r   test_identifiers_not_allowed      
"z/TestMakeTupleBunch.test_identifiers_not_allowed)rR   rS   rR   c                 C   r]   )N	Duplicater   r_   ra   r   r   r   test_repeated_field_names      
"z,TestMakeTupleBunch.test_repeated_field_names_a_xc                 C   r]   )N
underscorer   r_   ra   r   r   r   #test_leading_underscore_not_allowed   rf   z6TestMakeTupleBunch.test_leading_underscore_not_alloweddeforandc                 C   r]   )Nkeywordr   r_   ra   r   r   r   "test_keyword_not_allowed_in_fields   rc   z5TestMakeTupleBunch.test_keyword_not_allowed_in_fieldsc                 C   sD   t jtdd tdg ddg W d    d S 1 sw   Y  d S )Nzat least one namer   QwertyrR   rS   r_   r   r   r   r   %test_at_least_one_field_name_required   s   "z8TestMakeTupleBunch.test_at_least_one_field_name_requiredN)__name__rC   __qualname__r   r   r   r$   r%   r'   r*   r,   r2   r6   r9   r>   rB   rE   rK   rP   rV   rZ   r   markparametrizerb   re   rj   ro   rq   r   r   r   r   r
      sL    




r
   )r   r-   numpy.testingr   scipy._lib._bunchr   r   r
   r   r   r   r   <module>   s   