o
    Ö­j  ã                   @   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   úX/var/www/html/CropPilot/venv/lib/python3.10/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   ƒ 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_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   ƒ d S 1 sw   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   Úplate_of_shrimpr   r   r   r   Útest_read_only_newG   s   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_parameterK   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   é{   r8   iç  )r   r   r   r   r	   Úfoor9   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    )rC   rD   rE   )r   r   r   r	   )r   Úresult1Ú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   )rJ   rK   zSquare(width=1, height=2))r   r   rJ   rK   r(   )r   rI   Ú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   )rO   rP   )r   )r   r0   Útuple)r   rN   Ú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   rO   rP   )Úmoduler   ic  éq   )r   rO   rP   )r   r   r@   )r   rA   rT   r>   r   r   r   Útest_explicit_module{   s
   z'TestMakeTupleBunch.test_explicit_moduleÚargsÚ123rO   rP   rT   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   rX   r   r   r   Útest_identifiers_not_allowed†   ó   
"ÿz/TestMakeTupleBunch.test_identifiers_not_allowed)rO   rP   rO   c                 C   rZ   )NÚ	Duplicater   r\   r^   r   r   r   Útest_repeated_field_names�   ó   
"ÿz,TestMakeTupleBunch.test_repeated_field_namesÚ_aÚ_xc                 C   rZ   )NÚ
underscorer   r\   r^   r   r   r   Ú#test_leading_underscore_not_allowed“   rc   z6TestMakeTupleBunch.test_leading_underscore_not_allowedÚdefÚorÚandc                 C   rZ   )NÚkeywordr   r\   r^   r   r   r   Ú"test_keyword_not_allowed_in_fields™   r`   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   ÚQwertyrO   rP   r\   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,   r2   r4   r6   r;   r?   rB   rH   rM   rS   rW   r   ÚmarkÚparametrizer_   rb   rg   rl   rn   r   r   r   r   r
      sL    
þ
ÿ
ÿ
þ
r
   )r   r-   Únumpy.testingr   Úscipy._lib._bunchr   r   r
   r   r   r   r   Ú<module>   s    