コード例 #1
0
ファイル: test_point.py プロジェクト: nilp0inter/pymvptree
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])
コード例 #2
0
ファイル: test_point.py プロジェクト: nilp0inter/pymvptree
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 *"))
コード例 #3
0
ファイル: test_tree.py プロジェクト: nilp0inter/pymvptree
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))