()
| 117 | |
| 118 | |
| 119 | def test_instances(): |
| 120 | # Test the finfo and iinfo results on numeric instances agree with |
| 121 | # the results on the corresponding types |
| 122 | |
| 123 | for c in [int, np.int16, np.int32, np.int64]: |
| 124 | class_iinfo = iinfo(c) |
| 125 | instance_iinfo = iinfo(c(12)) |
| 126 | |
| 127 | assert_iinfo_equal(class_iinfo, instance_iinfo) |
| 128 | |
| 129 | for c in [float, np.float16, np.float32, np.float64]: |
| 130 | class_finfo = finfo(c) |
| 131 | instance_finfo = finfo(c(1.2)) |
| 132 | assert_finfo_equal(class_finfo, instance_finfo) |
| 133 | |
| 134 | with pytest.raises(ValueError): |
| 135 | iinfo(10.) |
| 136 | |
| 137 | with pytest.raises(ValueError): |
| 138 | iinfo('hi') |
| 139 | |
| 140 | with pytest.raises(ValueError): |
| 141 | finfo(np.int64(1)) |
| 142 | |
| 143 | |
| 144 | def test_subnormal_warning(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…