Could you also please add tests for the other values of the `algorithm` parameter and non-default values for `leaf_size` and `p`.

Also please write tests that check for invalid values of those parameters using `assert_raises` and `ValueError` as the expected exception type.