(self)
| 400 | assert_equal(ls, linspace(0.0, 1.0, 1)) |
| 401 | |
| 402 | def test_array_interface(self): |
| 403 | # Regression test for https://github.com/numpy/numpy/pull/6659 |
| 404 | # Ensure that start/stop can be objects that implement |
| 405 | # __array_interface__ and are convertible to numeric scalars |
| 406 | |
| 407 | class Arrayish: |
| 408 | """ |
| 409 | A generic object that supports the __array_interface__ and hence |
| 410 | can in principle be converted to a numeric scalar, but is not |
| 411 | otherwise recognized as numeric, but also happens to support |
| 412 | multiplication by floats. |
| 413 | |
| 414 | Data should be an object that implements the buffer interface, |
| 415 | and contains at least 4 bytes. |
| 416 | """ |
| 417 | |
| 418 | def __init__(self, data): |
| 419 | self._data = data |
| 420 | |
| 421 | @property |
| 422 | def __array_interface__(self): |
| 423 | return {'shape': (), 'typestr': '<i4', 'data': self._data, |
| 424 | 'version': 3} |
| 425 | |
| 426 | def __mul__(self, other): |
| 427 | # For the purposes of this test any multiplication is an |
| 428 | # identity operation :) |
| 429 | return self |
| 430 | |
| 431 | one = Arrayish(array(1, dtype='<i4')) |
| 432 | five = Arrayish(array(5, dtype='<i4')) |
| 433 | |
| 434 | assert_equal(linspace(one, five), linspace(1, 5)) |
| 435 | |
| 436 | # even when not explicitly enabled via FPSCR register |
| 437 | @pytest.mark.xfail(_is_armhf(), |
nothing calls this directly
no test coverage detected