OwlCyberSecurity - MANAGER
Edit File: testutils.cpython-38.pyc
U �i]}( � @ sf d Z ddlmZmZmZ ddlZddlZddlmZm Z ddl m mZ ddl Zddl mZmZmZmZmZ ddlmZmZmZmZmZmZ dd d ddd ddddddddgZddlmZ dddddgZee Zd2dd �Zd3d!d�Zd4d#d$�Z d%d� Z!d5d&d�Z"d6d'd(�Z#e#Z$d7d*d �Z%e%Z&d8d+d �Z'd9d,d�Z(d:d-d�Z)d;d.d�Z*d<d/d�Z+d=d0d�Z,d>d1d�Z-dS )?z�Miscellaneous functions for testing masked arrays and subclasses :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu :version: $Id: testutils.py 3529 2007-11-13 08:01:14Z jarrod.millman $ � )�division�absolute_import�print_functionN)�ndarray�float_)�assert_�assert_allclose�assert_array_almost_equal_nulp� assert_raises� build_err_msg� )�mask_or�getmask�masked_array�nomask�masked�filled�almost�approx�assert_almost_equal�assert_array_almost_equal�assert_array_approx_equal�assert_array_compare�assert_array_equal�assert_array_less�assert_close�assert_equal�assert_equal_records�assert_mask_equal�assert_not_equal�fail_if_array_equal)�TestCaser! r r r r T��h㈵��>�:�0�yE>c C s� t t| �t|��}t| �}t|�}|jjdks:|jjdkrJt�||��� S tt|d|d�|�� t �}tt|d|d�d�� t �} t�t� || �||t� | � �} | �� S )a� Returns true if all components of a and b are equal to given tolerances. If fill_value is True, masked values considered equal. Otherwise, masked values are considered unequal. The relative error rtol should be positive and << 1.0 The absolute error atol comes into play for those elements of b that are very small or zero; it says how small a must be also. �OF��copy�maskr )r r r �dtype�char�np�equal�ravelr �astyper Z less_equal�umathZabsolute)�a�b� fill_value�rtolZatol�m�d1�d2�x�y�d� r9 �4/usr/lib/python3/dist-packages/numpy/ma/testutils.pyr + s $� c C s� t t| �t|��}t| �}t|�}|jjdks:|jjdkrJt�||��� S tt|d|d�|�� t �}tt|d|d�d�� t �}t�t�|| �|�d| k} | �� S )z� Returns True if a and b are equal up to decimal places. If fill_value is True, masked values considered equal. Otherwise, masked values are considered unequal. r$ Fr% r � $@) r r r r( r) r* r+ r, r r- r Zaround�abs) r/ r0 �decimalr1 r3 r4 r5 r6 r7 r8 r9 r9 r: r A s � c C sF t t| �t|�|� tt|��D ] }t | | || d||f � q dS )z; Asserts the equality of two non-array sequences. � item=%r %sN)r �len�range)�actual�desired�err_msg�kr9 r9 r: �_assert_equal_on_sequencesT s rG c C sd t | j|j� | jjD ]H}t�| |�t�||� }}|tk r|tk rt t�| |�t�||�� qdS )zI Asserts that two records are equal. Pretty crude for now. N)r r( �names�operator�getitemr )r/ r0 �fZafZbfr9 r9 r: r _ s c C s� t |t�r�t | t�s$ttt| ����tt| �t|�|� |�� D ]<\}}|| kr`td|| f ��t| | || d||f � q@dS t |tt f�r�t | tt f�r�t | |dd�S t | t�s�t |t�s�t| |g|�}|| ks�t|��dS | t kr�|t k �s|t k�r$| t k �r$t| |g|ddd�}t|��tj| dd d �} tj|dd d �}| j|j }}|jdk�r�|jdk�r�t | �� |�� dd�S t| ||�S )z, Asserts that two items are equal. z%s not in %s� key=%r %sNr? �rE �r6 r7 )�headerrH FT)r&