mwilliamson / python-precisely

Matcher library for Python
BSD 2-Clause "Simplified" License
238 stars 11 forks source link

NaN matcher for np.nan #15

Open danodonovan opened 3 years ago

danodonovan commented 3 years ago

How would you feel about a PR for a matcher that checked if a value was NaN (for the numpy definition of NaN)?

Perhaps something like is_nan() ? (and using np.isnan under the hood).

NB By design NaN != NaN so equal_to(np.nan) wouldn't work here.

mwilliamson commented 3 years ago

Hmm, anything that relies on numpy should probably go in a separate module. I'm not opposed in principle though.

The alternative would be to add a more general is_ matcher, so you can write is_(np.nan).