Write test for nearest_neighbor