def test_fromvalue(target_info): assert Type.fromvalue(1) == Type.fromstring('i64') assert Type.fromvalue(1.0) == Type.fromstring('f64') assert Type.fromvalue(1j) == Type.fromstring('c128') assert Type.fromvalue("123".encode()) == Type.fromstring('char*') assert Type.fromvalue("123") == Type.fromstring('string') x = np.dtype(np.float64).type(3.0) assert Type.fromvalue(x) == Type.fromstring('float64') y = np.dtype(np.complex64).type((1+2j)) assert Type.fromvalue(y) == Type.fromstring('complex64')
def Type_fromvalue(s): return Type.fromvalue(s, target_info)