def test_map():
    fk = Map(int32, Record([('a', int32)]))
    assert fk.key == int32
    assert fk.value == Record([('a', int32)])
    assert fk.value.dict == {'a': int32}
    assert fk.value.fields == (('a', int32), )
    assert fk.to_numpy_dtype() == np.dtype('int32')
def test_map():
    fk = Map(int32, Record([('a', int32)]))
    assert fk.key == int32
    assert fk.value == Record([('a', int32)])
    assert fk.value.dict == {'a': int32}
    assert fk.value.fields == (('a', int32),)
    with pytest.raises(TypeError):
        fk.to_numpy_dtype()
Example #3
0
def test_map():
    fk = Map(int32, Record([('a', int32)]))
    assert fk.key == int32
    assert fk.value == Record([('a', int32)])
    assert fk.value.dict == {'a': int32}
    assert fk.value.fields == (('a', int32), )
    with pytest.raises(TypeError):
        fk.to_numpy_dtype()
def test_map_parse():
    result = dshape("var * {b: map[int32, {a: int64}]}")
    recmeasure = Map(dshape(int32), DataShape(Record([('a', int64)])))
    assert result == DataShape(var, Record([('b', recmeasure)]))