3
Odx                 @   s   d Z ddlZddlmZmZmZmZmZ ddlm	Z	 ddl
Z
dd Zdd Ze
jjed	d
dd Ze
jjed	d
dd Ze
jjed	d
dd Ze
jjed	d
dd ZdS )z> Test for assert_deallocated context manager and gc utilities
    N)set_gc_stategc_stateassert_deallocatedReferenceErrorIS_PYPY)assert_equalc           
   C   sj   t j } zNxHdD ]@}t j  t| tt j | t j  t| tt j | qW W d | rdt j  X d S )NTF)TF)gc	isenabledenabler   r   disable)	gc_statusstate r   R/var/www/html/virt/lib64/python3.6/site-packages/scipy/_lib/tests/test__gcutils.pytest_set_gc_state   s    
r   c              C   s   t j } zxdD ]}t| xvdD ]n}t| tt j | W d Q R X tt j | t| tt j | t|  W d Q R X tt j | q"W qW W d | rt j  X d S )NTF)TF)TF)r   r	   r   r   r   r
   )r   Z	pre_stateZ
with_stater   r   r   test_gc_state   s    



r   zTest not meaningful on PyPy)reasonc              C   s   G dd dt } xrd
D ]j}t|X t| ddd}t|jd ~W d Q R X t| dddd	 W d Q R X ttj | W d Q R X qW d S )Nc               @   s   e Zd ZdddZdS )z"test_assert_deallocated.<locals>.Cmynamec             S   s
   || _ d S )N)name)selfZarg0Zarg1r   r   r   r   __init__6   s    z+test_assert_deallocated.<locals>.C.__init__N)r   )__name__
__module____qualname__r   r   r   r   r   C5   s   r   TFr      zanother namez
third name)r   )TF)objectr   r   r   r   r   r	   )r   Z
gc_currentcr   r   r   test_assert_deallocated2   s    


r   c              C   s>   G dd dt } tjt t| }W d Q R X W d Q R X d S )Nc               @   s   e Zd ZdS )z(test_assert_deallocated_nodel.<locals>.CN)r   r   r   r   r   r   r   r   F   s   r   )r   pytestraisesr   r   )r   r   r   r   r   test_assert_deallocated_nodelD   s    
r!   c              C   s@   G dd dt } tjt t| }~W d Q R X W d Q R X d S )Nc               @   s   e Zd Zdd ZdS )z+test_assert_deallocated_circular.<locals>.Cc             S   s
   | | _ d S )N)	_circular)r   r   r   r   r   U   s    z4test_assert_deallocated_circular.<locals>.C.__init__N)r   r   r   r   r   r   r   r   r   T   s   r   )r   r   r    r   r   )r   r   r   r   r    test_assert_deallocated_circularR   s    
r#   c              C   s>   G dd dt } tjt t|  W d Q R X W d Q R X d S )Nc               @   s   e Zd Zdd ZdS )z,test_assert_deallocated_circular2.<locals>.Cc             S   s
   | | _ d S )N)r"   )r   r   r   r   r   `   s    z5test_assert_deallocated_circular2.<locals>.C.__init__N)r   r   r   r   r   r   r   r   r   _   s   r   )r   r   r    r   r   )r   r   r   r   !test_assert_deallocated_circular2]   s    
r$   )__doc__r   Zscipy._lib._gcutilsr   r   r   r   r   Znumpy.testingr   r   r   r   markZskipifr   r!   r#   r$   r   r   r   r   <module>   s   