def test_search_1D(): tree = KDTree([1]) right = KDTree([2]) left = KDTree([0]) tree.right = right tree.left = left assert tree.search([2]) == right assert tree.search([0]) == left assert tree.search([3]) is None assert tree.search([-1]) is None
def test_search_accept(): tree = KDTree(KDSubType(1,1), accept=KDSubType) left = KDTree(KDSubType(1,0), accept=KDSubType) tree.left = left assert tree.search(KDSubType(1,0)) == left assert tree.search(KDSubType(1,3)) is None