class documentation

class TestTypes:

View In Hierarchy

Undocumented

Method check​_promotion​_cases Undocumented
Method test​_can​_cast Undocumented
Method test​_can​_cast​_and​_promote​_usertypes Undocumented
Method test​_can​_cast​_simple​_to​_structured Undocumented
Method test​_can​_cast​_structured​_to​_simple Undocumented
Method test​_can​_cast​_values Undocumented
Method test​_coercion Undocumented
Method test​_invalid​_void​_promotion Undocumented
Method test​_promote​_identical​_types​_metadata Undocumented
Method test​_promote​_types​_endian Undocumented
Method test​_promote​_types​_metadata Metadata handling in promotion does not appear formalized right now in NumPy. This test should thus be considered to document behaviour, rather than test the correct definition of it.
Method test​_promote​_types​_strings Undocumented
Method test​_result​_type Undocumented
Method test​_valid​_void​_promotion Undocumented
def check_promotion_cases(self, promote_func):

Undocumented

def test_can_cast(self):

Undocumented

def test_can_cast_and_promote_usertypes(self):

Undocumented

def test_can_cast_simple_to_structured(self):

Undocumented

def test_can_cast_structured_to_simple(self):

Undocumented

def test_can_cast_values(self):

Undocumented

def test_coercion(self):

Undocumented

@pytest.mark.parametrize(['dtype1', 'dtype2'], [[np.dtype('V6'), np.dtype('V10')], [np.dtype([('name1', 'i8')]), np.dtype([('name2', 'i8')])], [np.dtype('i8,i8'), np.dtype('i4,i4')]])
def test_invalid_void_promotion(self, dtype1, dtype2):

Undocumented

@pytest.mark.parametrize('dtype', list(np.typecodes['All'])+['i,i', 'S3', 'S100', 'U3', 'U100', rational])
def test_promote_identical_types_metadata(self, dtype):

Undocumented

def test_promote_types_endian(self):

Undocumented

@pytest.mark.slow
@pytest.mark.filterwarnings('ignore:Promotion of numbers:FutureWarning')
@pytest.mark.parametrize(['dtype1', 'dtype2'], itertools.product(list(np.typecodes['All'])+['i,i', 'S3', 'S100', 'U3', 'U100', rational], repeat=2))
def test_promote_types_metadata(self, dtype1, dtype2):

Metadata handling in promotion does not appear formalized right now in NumPy. This test should thus be considered to document behaviour, rather than test the correct definition of it.

This test is very ugly, it was useful for rewriting part of the promotion, but probably should eventually be replaced/deleted (i.e. when metadata handling in promotion is better defined).

@pytest.mark.parametrize('swap', ['', 'swap'])
@pytest.mark.parametrize('string_dtype', ['U', 'S'])
def test_promote_types_strings(self, swap, string_dtype):

Undocumented

def test_result_type(self):

Undocumented

@pytest.mark.parametrize(['dtype1', 'dtype2'], [[np.dtype('V10'), np.dtype('V10')], [np.dtype([('name1', '<i8')]), np.dtype([('name1', '>i8')])], [np.dtype('i8,i8'), np.dtype('i8,>i8')]])
def test_valid_void_promotion(self, dtype1, dtype2):

Undocumented