(self, absfunc, test_dtype)
| 748 | |
| 749 | class TestAbs: |
| 750 | def _test_abs_func(self, absfunc, test_dtype): |
| 751 | x = test_dtype(-1.5) |
| 752 | assert_equal(absfunc(x), 1.5) |
| 753 | x = test_dtype(0.0) |
| 754 | res = absfunc(x) |
| 755 | # assert_equal() checks zero signedness |
| 756 | assert_equal(res, 0.0) |
| 757 | x = test_dtype(-0.0) |
| 758 | res = absfunc(x) |
| 759 | assert_equal(res, 0.0) |
| 760 | |
| 761 | x = test_dtype(np.finfo(test_dtype).max) |
| 762 | assert_equal(absfunc(x), x.real) |
| 763 | |
| 764 | with warnings.catch_warnings(): |
| 765 | warnings.simplefilter('ignore', UserWarning) |
| 766 | x = test_dtype(np.finfo(test_dtype).tiny) |
| 767 | assert_equal(absfunc(x), x.real) |
| 768 | |
| 769 | x = test_dtype(np.finfo(test_dtype).min) |
| 770 | assert_equal(absfunc(x), -x.real) |
| 771 | |
| 772 | @pytest.mark.parametrize("dtype", floating_types + complex_floating_types) |
| 773 | def test_builtin_abs(self, dtype): |
no test coverage detected