Ejemplo n.º 1
0
def test_Point_c_obj_cant_be_NULL():
    from pymvptree import Point
    from _c_mvptree import ffi

    with pytest.raises(TypeError):
        c_obj = ffi.new('MVPDP *[1]', [ffi.NULL])
        p = Point(c_obj=c_obj[0])
Ejemplo n.º 2
0
def test_Point_needs_c_obj_cant_be_other_ctype():
    from pymvptree import Point
    from _c_mvptree import ffi

    with pytest.raises(TypeError):
        p = Point(c_obj=ffi.NULL)

    with pytest.raises(TypeError):
        p = Point(c_obj=ffi.new("int *"))
Ejemplo n.º 3
0
def test_Tree_c_obj_must_be_MVPTree():
    from pymvptree import Tree, MVP_BRANCHFACTOR, MVP_PATHLENGTH, MVP_LEAFCAP
    from _c_mvptree import ffi, lib

    with pytest.raises(TypeError):
        Tree(c_obj=b'lala')

    with pytest.raises(TypeError):
        Tree(c_obj=ffi.new('int *'))

    with pytest.raises(TypeError):
        Tree(c_obj=ffi.NULL)

    Tree(c_obj=lib.mktree(MVP_BRANCHFACTOR, MVP_PATHLENGTH, MVP_LEAFCAP))