(self)
| 2701 | assert_(not isinstance(test.mask, MaskedArray)) |
| 2702 | |
| 2703 | def test_treatment_of_NotImplemented(self): |
| 2704 | # Check that NotImplemented is returned at appropriate places |
| 2705 | |
| 2706 | a = masked_array([1., 2.], mask=[1, 0]) |
| 2707 | assert_raises(TypeError, operator.mul, a, "abc") |
| 2708 | assert_raises(TypeError, operator.truediv, a, "abc") |
| 2709 | |
| 2710 | class MyClass: |
| 2711 | __array_priority__ = a.__array_priority__ + 1 |
| 2712 | |
| 2713 | def __mul__(self, other): |
| 2714 | return "My mul" |
| 2715 | |
| 2716 | def __rmul__(self, other): |
| 2717 | return "My rmul" |
| 2718 | |
| 2719 | me = MyClass() |
| 2720 | assert_(me * a == "My mul") |
| 2721 | assert_(a * me == "My rmul") |
| 2722 | |
| 2723 | # and that __array_priority__ is respected |
| 2724 | class MyClass2: |
| 2725 | __array_priority__ = 100 |
| 2726 | |
| 2727 | def __mul__(self, other): |
| 2728 | return "Me2mul" |
| 2729 | |
| 2730 | def __rmul__(self, other): |
| 2731 | return "Me2rmul" |
| 2732 | |
| 2733 | def __rtruediv__(self, other): |
| 2734 | return "Me2rdiv" |
| 2735 | |
| 2736 | me_too = MyClass2() |
| 2737 | assert_(a.__mul__(me_too) is NotImplemented) |
| 2738 | assert_(all(multiply.outer(a, me_too) == "Me2rmul")) |
| 2739 | assert_(a.__truediv__(me_too) is NotImplemented) |
| 2740 | assert_(me_too * a == "Me2mul") |
| 2741 | assert_(a * me_too == "Me2rmul") |
| 2742 | assert_(a / me_too == "Me2rdiv") |
| 2743 | |
| 2744 | def test_no_masked_nan_warnings(self): |
| 2745 | # check that a nan in masked position does not |
nothing calls this directly
no test coverage detected