Exemplo n.º 1
0
def test_vlen_dtype():
    dtype = strings.create_vlen_dtype(unicode_type)
    assert dtype.metadata['element_type'] == unicode_type
    assert strings.is_unicode_dtype(dtype)
    assert not strings.is_bytes_dtype(dtype)
    assert strings.check_vlen_dtype(dtype) is unicode_type

    dtype = strings.create_vlen_dtype(bytes_type)
    assert dtype.metadata['element_type'] == bytes_type
    assert not strings.is_unicode_dtype(dtype)
    assert strings.is_bytes_dtype(dtype)
    assert strings.check_vlen_dtype(dtype) is bytes_type

    assert strings.check_vlen_dtype(np.dtype(object)) is None
Exemplo n.º 2
0
def test_vlen_dtype():
    dtype = strings.create_vlen_dtype(unicode_type)
    assert dtype.metadata['element_type'] == unicode_type
    assert strings.is_unicode_dtype(dtype)
    assert not strings.is_bytes_dtype(dtype)
    assert strings.check_vlen_dtype(dtype) is unicode_type

    dtype = strings.create_vlen_dtype(bytes_type)
    assert dtype.metadata['element_type'] == bytes_type
    assert not strings.is_unicode_dtype(dtype)
    assert strings.is_bytes_dtype(dtype)
    assert strings.check_vlen_dtype(dtype) is bytes_type

    assert strings.check_vlen_dtype(np.dtype(object)) is None
Exemplo n.º 3
0
def test_vlen_dtype():
    dtype = strings.create_vlen_dtype(str)
    assert dtype.metadata["element_type"] == str
    assert strings.is_unicode_dtype(dtype)
    assert not strings.is_bytes_dtype(dtype)
    assert strings.check_vlen_dtype(dtype) is str

    dtype = strings.create_vlen_dtype(bytes)
    assert dtype.metadata["element_type"] == bytes
    assert not strings.is_unicode_dtype(dtype)
    assert strings.is_bytes_dtype(dtype)
    assert strings.check_vlen_dtype(dtype) is bytes

    assert strings.check_vlen_dtype(np.dtype(object)) is None