Esempio n. 1
0
def test_promote_types_su(space):
    dt_int8 = num2dtype(space, NPY.BYTE)
    dt_uint8 = num2dtype(space, NPY.UBYTE)
    dt_int16 = num2dtype(space, NPY.SHORT)
    dt_uint16 = num2dtype(space, NPY.USHORT)
    # The results must be signed
    assert _promote_types_su(space, dt_int8, dt_int16, False, False) == (dt_int16, False)
    assert _promote_types_su(space, dt_int8, dt_int16, True, False) == (dt_int16, False)
    assert _promote_types_su(space, dt_int8, dt_int16, False, True) == (dt_int16, False)

    # The results may be unsigned
    assert _promote_types_su(space, dt_int8, dt_int16, True, True) == (dt_int16, True)
    assert _promote_types_su(space, dt_uint8, dt_int16, False, True) == (dt_uint16, True)
Esempio n. 2
0
def test_promote_types_su(space):
    dt_int8 = num2dtype(space, NPY.BYTE)
    dt_uint8 = num2dtype(space, NPY.UBYTE)
    dt_int16 = num2dtype(space, NPY.SHORT)
    dt_uint16 = num2dtype(space, NPY.USHORT)
    # The results must be signed
    assert _promote_types_su(space, dt_int8, dt_int16, False,
                             False) == (dt_int16, False)
    assert _promote_types_su(space, dt_int8, dt_int16, True,
                             False) == (dt_int16, False)
    assert _promote_types_su(space, dt_int8, dt_int16, False,
                             True) == (dt_int16, False)

    # The results may be unsigned
    assert _promote_types_su(space, dt_int8, dt_int16, True,
                             True) == (dt_int16, True)
    assert _promote_types_su(space, dt_uint8, dt_int16, False,
                             True) == (dt_uint16, True)
Esempio n. 3
0
 def _get_dtype(space):
     from pypy.module.micronumpy.descriptor import num2dtype
     return num2dtype(space, num)
Esempio n. 4
0
 def _get_dtype(space):
     from pypy.module.micronumpy.descriptor import num2dtype
     return num2dtype(space, num)