Check inf/nan formatting of complex types.
(dtype)
| 74 | |
| 75 | @pytest.mark.parametrize('dtype', [np.complex64, np.cdouble, np.clongdouble]) |
| 76 | def test_complex_inf_nan(dtype): |
| 77 | """Check inf/nan formatting of complex types.""" |
| 78 | TESTS = { |
| 79 | complex(np.inf, 0): "(inf+0j)", |
| 80 | complex(0, np.inf): "infj", |
| 81 | complex(-np.inf, 0): "(-inf+0j)", |
| 82 | complex(0, -np.inf): "-infj", |
| 83 | complex(np.inf, 1): "(inf+1j)", |
| 84 | complex(1, np.inf): "(1+infj)", |
| 85 | complex(-np.inf, 1): "(-inf+1j)", |
| 86 | complex(1, -np.inf): "(1-infj)", |
| 87 | complex(np.nan, 0): "(nan+0j)", |
| 88 | complex(0, np.nan): "nanj", |
| 89 | complex(-np.nan, 0): "(nan+0j)", |
| 90 | complex(0, -np.nan): "nanj", |
| 91 | complex(np.nan, 1): "(nan+1j)", |
| 92 | complex(1, np.nan): "(1+nanj)", |
| 93 | complex(-np.nan, 1): "(nan+1j)", |
| 94 | complex(1, -np.nan): "(1+nanj)", |
| 95 | } |
| 96 | for c, s in TESTS.items(): |
| 97 | assert_equal(str(dtype(c)), s) |
| 98 | |
| 99 | |
| 100 | # print tests |
nothing calls this directly
no test coverage detected
searching dependent graphs…