BUG: Fix invalid value raised as error when testing on Windows.

The invalid value RuntimeWarning is raised as an error in numpy
testing, and in this case the Window build was raising the warning
for comparisons of NaNs.

Fixes the first error in #4698.