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])
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 *"))
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))