관리-도구
편집 파일: test_core.cpython-37.pyc
B ��Fd�� � @ s� d Z ddlmZmZmZ dZddlZddlZddlZddl Z ddl mZ ddlZ ddlZddlm mZ ddlm mZ ddlmZmZmZmZmZ ddlmZ ddlmZmZ dd lmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& dd lm'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcmdZdmeZemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZumvZvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~mZm�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z� e j�Z�e� Z�e���ej�jj�d� G dd � d e�Z�G dd� de�Z�G dd� de�Z�G dd� de�Z�G dd� de�Z�G dd� de�Z�G dd� de�Z�G dd� de�Z�G dd� de�Z�G dd� de�Z�G d d!� d!e�Z�G d"d#� d#e�Z�G d$d%� d%e�Z�G d&d'� d'e�Z�G d(d)� d)e�Z�d*d+� Z�d,d-� Z�d.d/� Z�d0d1� Z�d2d3� Z�e�d4k�r�e� dS )5znTests suite for MaskedArray & subclassing. :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu � )�division�absolute_import�print_functionzPierre GF Gerard-MarchantN)�reduce)�TestCase�run_module_suite� assert_raises�assert_warns�suppress_warnings)�ndarray)�asbytes�asbytes_nested)�assert_�assert_array_equal�assert_equal�assert_almost_equal�assert_equal_records� fail_if_equal�assert_not_equal�assert_mask_equal)f�MAError� MaskError�MaskType�MaskedArray�abs�absolute�add�all�allclose�allequal�alltrue�angle�anom�arange�arccos�arccosh�arctan2�arcsin�arctan�argsort�array�asarray�choose�concatenate� conjugate�cos�cosh�count�default_fill_value�diag�divide�empty� empty_like�equal�exp�flatten_mask�filled�fix_invalid�flatten_structured_array�fromflex�getmask�getmaskarray�greater� greater_equal�identity�inner� isMaskedArray�less� less_equal�log�log10� make_mask�make_mask_descr�mask_or�masked�masked_array�masked_equal�masked_greater�masked_greater_equal� masked_inside�masked_less�masked_less_equal�masked_not_equal�masked_outside�masked_print_option� masked_values�masked_where�max�maximum�maximum_fill_value�min�minimum�minimum_fill_value�mod�multiply�mvoid�nomask� not_equal�ones�outer�power�product�put�putmask�ravel�repeat�reshape�resize�shape�sin�sinh�sometrue�sort�sqrt�subtract�sum�take�tan�tanh� transpose�where�zeroszGsetting an item on a masked array which has a shared mask will not copyc @ s� e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zed+d,� �Zd-d.� Zd/d0� Zd1d2� Zd3d4� Zd5d6� Zd7d8� Zd9d:� Z d;d<� Z!d=d>� Z"d?d@� Z#dAdB� Z$dCdD� Z%dEdF� Z&edGdH� �Z'dIdJ� Z(dKdL� Z)dMdN� Z*dOdP� Z+dQdR� Z,dSdT� Z-dUdV� Z.dWdX� Z/dYdZ� Z0d[d\� Z1d]d^� Z2d_d`� Z3dadb� Z4dcdd� Z5deS )f�TestMaskedArrayc C s� t �ddddtd dddddddg�}t �dd ddd dd dddd dg�}d}dd d d d d dd d d d d g}d d dd d ddd d d d dg}t||d�}t||d�}t �dd ddg�}t|d dd d gd�} t �|d|�} |�d� ||||||||| | f | _d S )Ng �?g �g @g @g @g $�g $@g @g g �g �� r )�maskg �g �?g�������?g@��x�D)�npr* �pirM rz �set_fill_value�d)�self�x�y�a10�m1�m2�xm�ym�z�zm�xf� r� ��/builddir/build/BUILDROOT/alt-python37-numpy-1.13.3-8.el8.x86_64/opt/alt/python37/lib64/python3.7/site-packages/numpy/ma/tests/test_core.py�setUp= s &" zTestMaskedArray.setUpc C sr t dddg�}t dddgdddgd�}t|jd� t|jd� t|jd� t|jd� t|jd� t|jd� d S )Nr} � � r )r~ )r� )r* r �ndim�sizern )r� �a�br� r� r� �test_basicattributesL s z$TestMaskedArray.test_basicattributesc C sv t d�}tt|�d� t ddd�}tt|�tt�� t ddd�}tt|�d� tddd�}| �|�� j|jjk� d S )Nr �0T)r~ Fr} ) rM r �strrV r* � assertTruer: �dtype�_data)r� r� r� r� r� �test_basic0dW s zTestMaskedArray.test_basic0dc C s | j \ }}}}}}}}} } | �t|� � | �t|�� | �|| �d��� � t|j�t�|j�t�� |j }t t� |�|� t |j |� t |j|j� t | j|j� t |j tdd� |�� t t|�t|�tdd� |� � t|| � tt|d�| � t||� d S )Nr c S s | | S )Nr� )r� r� r� r� r� �<lambda>n � z.TestMaskedArray.test_basic1d.<locals>.<lambda>c S s | | S )Nr� )r� r� r� r� r� r� o r� g@��x�D)r� r� rD r: �anyr r~ �astype�intrn r r r� r� r r1 �lenr )r� r� r� r� r� r� r� r� r� r� r� �sr� r� r� �test_basic1db s zTestMaskedArray.test_basic1dc C s� | j \ }}}}}}}}} } x�dD ]�}||_||_||_||_|| _| �t|� � | �t|�� tt|�|� t|j|� t|jtdd� |�� tt|�t|�tdd� |� � t|| � tt |d�| � t||� q W d S )N))� r� )� r� c S s | | S )Nr� )r� r� r� r� r� r� � r� z.TestMaskedArray.test_basic2d.<locals>.<lambda>c S s | | S )Nr� )r� r� r� r� r� r� � r� g@��x�D) r� rn r� rD r r� r r1 r� r: )r� r� r� r� r� r� r� r� r� r� r� r� r� r� r� �test_basic2dt s zTestMaskedArray.test_basic2dc C s� | j \ }}}}}}}}} } tt�||f�t||f�� tt�||f�t||f�� tt�||f�t||f�� tt�|||f�t|||f�� d S )N)r� r r r- )r� r� r� r� r� r� r� r� r� r� r� r� r� r� �test_concatenate_basic� s z&TestMaskedArray.test_concatenate_basicc C s" | j \ }}}}}}}}} } d}| |_ |_ |_|_t|jt�||�� t|jt�||�� t||fd�}tt�||fd�|� tt�|j|jfd�|j� td�}t t d�ddgd�}t||f�}t|ddddg� t|jddddg� t||f�}t|ddddg� t|jddddg� d S )N)r� r� r} r� FT)r~ r )r� rn r r~ r rl r- �_maskr{ r* rd r ) r� r� r� r� r� r� r� r� r� r� r� r� Zxmymr� r� r� �test_concatenate_alongaxis� s z*TestMaskedArray.test_concatenate_alongaxisc C sZ t tttj�d�t�d���dtfdtfgd�}t |d d� |dd � g�}t ||� d S )N� r� r� )r� � )rM �list�zipr �random�randr# �floatr� r- r )r� �data�testr� r� r� �test_concatenate_flexible� s z)TestMaskedArray.test_concatenate_flexiblec C sR t dddgdddgdd�}t|jd� t|jdddgg� t|jdddgg� d S )Nr} r� r� r )r~ �ndmin)r} r� )r* r rn r� r� )r� r� r� r� r� �test_creation_ndmin� s z#TestMaskedArray.test_creation_ndminc C sH t dddg�}t|d<