a
    Re                     @   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   O/var/www/sunrise/env/lib/python3.9/site-packages/scipy/_lib/tests/test_bunch.pysetup_method   s    zTestMakeTupleBunch.setup_methodc                 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    n1 sn0    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   Zx0Zy0Z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_len/   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_repr2   s    
zTestMakeTupleBunch.test_reprc                 C   s   t t| jtd d S r   )r   hashr   r   r   r   r   	test_hash6   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_pickle9   s    
zTestMakeTupleBunch.test_picklec                 C   s:   t jtdd d| j_W d    n1 s,0    Y  d S )Nzcan't set attributer   r   )r   r   AttributeErrorr   r   r   r   r   r   test_read_only_existingC   s    z*TestMakeTupleBunch.test_read_only_existingc                 C   s   d| j _| j jdksJ d S )Nzlattice of coincidence)r   Zplate_of_shrimpr   r   r   r   test_read_only_newG   s    z%TestMakeTupleBunch.test_read_only_newc                 C   sB   t jtdd  tddddd W d    n1 s40    Y  d S )Nmissingr   r   r   r         ?)r   r   r   r	   r   r   	TypeErrorr   r   r   r   r   "test_constructor_missing_parameterK   s    z5TestMakeTupleBunch.test_constructor_missing_parameterc              	   C   sF   t jtdd$ tddddddd	 W d    n1 s80    Y  d S )
NZ
unexpectedr   r   r   r   {   r4   i  )r   r   r   r   r	   foor5   r   r   r   r   $test_constructor_incorrect_parameterP   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_moduleU   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    )r>   r?   r@   )r   r   r   r	   )r   Zresult1Zresult2r   r   r   test_extra_fields_per_instanceZ   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   )rC   rD   zSquare(width=1, height=2))r   r   rC   rD   r%   )r   rB   sqr&   r   r   r   "test_extra_field_names_is_optionalm   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   )rH   rI   )r   )r   r-   tuple)r   rG   Ztur   r   r   test_tuple_likeu   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   rH   rI   )moduler   ic  q   )r   rH   rI   )r   r   r;   )r   r<   rL   r9   r   r   r   test_explicit_module{   s
    z'TestMakeTupleBunch.test_explicit_moduleargsZ123rH   rI   rL   z-3r   z+-*/c                 C   s:   t jtdd t|  W d    n1 s,0    Y  d S )NZidentifiersr   r   r   
ValueErrorr   r   rP   r   r   r   test_identifiers_not_allowed   s    z/TestMakeTupleBunch.test_identifiers_not_allowed)rH   rI   rH   c                 C   s:   t jtdd t|  W d    n1 s,0    Y  d S )NZ	Duplicater   rQ   rS   r   r   r   test_repeated_field_names   s    z,TestMakeTupleBunch.test_repeated_field_namesZ_a_xc                 C   s:   t jtdd t|  W d    n1 s,0    Y  d S )NZ
underscorer   rQ   rS   r   r   r   #test_leading_underscore_not_allowed   s    z6TestMakeTupleBunch.test_leading_underscore_not_alloweddeforandc                 C   s:   t jtdd t|  W d    n1 s,0    Y  d S )Nkeywordr   rQ   rS   r   r   r   "test_keyword_not_allowed_in_fields   s    z5TestMakeTupleBunch.test_keyword_not_allowed_in_fieldsc                 C   sB   t jtdd  tdg ddg W d    n1 s40    Y  d S )Nzat least one namer   ZQwertyrH   rI   rQ   r   r   r   r   %test_at_least_one_field_name_required   s    z8TestMakeTupleBunch.test_at_least_one_field_name_requiredN)__name__r;   __qualname__r   r   r   r!   r"   r$   r'   r)   r/   r1   r2   r7   r:   r=   rA   rF   rK   rO   r   markZparametrizerT   rU   rW   r\   r]   r   r   r   r   r
      sJ   




r
   )r   r*   Znumpy.testingr   Zscipy._lib._bunchr   r   r
   r   r   r   r   <module>   s
   