handle ties in knnW in doctest