(x, y)
| 757 | return x.dtype.char == "T" |
| 758 | |
| 759 | def robust_any_difference(x, y): |
| 760 | # We include work-arounds here to handle three types of slightly |
| 761 | # pathological ndarray subclasses: |
| 762 | # (1) all() on fully masked arrays returns np.ma.masked, so we use != True |
| 763 | # (np.ma.masked != True evaluates as np.ma.masked, which is falsy). |
| 764 | # (2) __eq__ on some ndarray subclasses returns Python booleans |
| 765 | # instead of element-wise comparisons, so we cast to np.bool() in |
| 766 | # that case (or in case __eq__ returns some other value with no |
| 767 | # all() method). |
| 768 | # (3) subclasses with bare-bones __array_function__ implementations may |
| 769 | # not implement np.all(), so favor using the .all() method |
| 770 | # We are not committed to supporting cases (2) and (3), but it's nice to |
| 771 | # support them if possible. |
| 772 | result = x == y |
| 773 | if not hasattr(result, "all") or not callable(result.all): |
| 774 | result = np.bool(result) |
| 775 | return result.all() != True |
| 776 | |
| 777 | def func_assert_same_pos(x, y, func=isnan, hasval='nan'): |
| 778 | """Handling nan/inf. |
no test coverage detected
searching dependent graphs…