Heray-Was-Here
Server : Apache
System : Linux vps43555.mylogin.co 3.10.0-1160.53.1.vz7.185.3 #1 SMP Tue Jan 25 12:49:12 MSK 2022 x86_64
User : redsea ( 60651)
PHP Version : 7.4.32
Disable Function : NONE
Directory :  /usr/lib64/python2.7/site-packages/numpy/core/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.7/site-packages/numpy/core/tests/test_indexing.py
import numpy as np
from numpy.compat import asbytes
from numpy.testing import *
import sys, warnings

# The C implementation of fancy indexing is relatively complicated,
# and has many seeming inconsistencies. It also appears to lack any
# kind of test suite, making any changes to the underlying code difficult
# because of its fragility.

# This file is to remedy the test suite part a little bit,
# but hopefully NumPy indexing can be changed to be more systematic
# at some point in the future.

def test_boolean_indexing():
    # Indexing a 2-dimensional array with a length-1 array of 'True'
    a = np.array([[ 0.,  0.,  0.]])
    b = np.array([ True], dtype=bool)
    assert_equal(a[b], a)

    a[b] = 1.
    assert_equal(a, [[1., 1., 1.]])

if __name__ == "__main__":
    run_module_suite()

Hry