(self, type_code: str)
| 72 | |
| 73 | @pytest.mark.parametrize("type_code", TYPE_CODES) |
| 74 | def test_poly1d_misc(self, type_code: str) -> None: |
| 75 | dtype = np.dtype(type_code) |
| 76 | ar = np.array([1, 2, 3], dtype=dtype) |
| 77 | p = np.poly1d(ar) |
| 78 | |
| 79 | # `__eq__` |
| 80 | assert_equal(np.asarray(p), ar) |
| 81 | assert_equal(np.asarray(p).dtype, dtype) |
| 82 | assert_equal(len(p), 2) |
| 83 | |
| 84 | # `__getitem__` |
| 85 | comparison_dct = {-1: 0, 0: 3, 1: 2, 2: 1, 3: 0} |
| 86 | for index, ref in comparison_dct.items(): |
| 87 | scalar = p[index] |
| 88 | assert_equal(scalar, ref) |
| 89 | if dtype == np.object_: |
| 90 | assert isinstance(scalar, int) |
| 91 | else: |
| 92 | assert_equal(scalar.dtype, dtype) |
| 93 | |
| 94 | def test_poly1d_variable_arg(self): |
| 95 | q = np.poly1d([1., 2, 3], variable='y') |
nothing calls this directly
no test coverage detected