|
| 1 | +import sys |
| 2 | + |
1 | 3 | import numpy as np |
| 4 | +from numpy._typing import _80Bit, _96Bit, _128Bit, _256Bit |
| 5 | + |
| 6 | +if sys.version_info >= (3, 11): |
| 7 | + from typing import assert_type |
| 8 | +else: |
| 9 | + from typing_extensions import assert_type |
2 | 10 |
|
3 | | -reveal_type(np.uint128()) |
4 | | -reveal_type(np.uint256()) |
| 11 | +assert_type(np.uint128(), np.unsignedinteger[_128Bit]) |
| 12 | +assert_type(np.uint256(), np.unsignedinteger[_256Bit]) |
5 | 13 |
|
6 | | -reveal_type(np.int128()) |
7 | | -reveal_type(np.int256()) |
| 14 | +assert_type(np.int128(), np.signedinteger[_128Bit]) |
| 15 | +assert_type(np.int256(), np.signedinteger[_256Bit]) |
8 | 16 |
|
9 | | -reveal_type(np.float80()) |
10 | | -reveal_type(np.float96()) |
11 | | -reveal_type(np.float128()) |
12 | | -reveal_type(np.float256()) |
| 17 | +assert_type(np.float80(), np.floating[_80Bit]) |
| 18 | +assert_type(np.float96(), np.floating[_96Bit]) |
| 19 | +assert_type(np.float128(), np.floating[_128Bit]) |
| 20 | +assert_type(np.float256(), np.floating[_256Bit]) |
13 | 21 |
|
14 | | -reveal_type(np.complex160()) |
15 | | -reveal_type(np.complex192()) |
16 | | -reveal_type(np.complex256()) |
17 | | -reveal_type(np.complex512()) |
| 22 | +assert_type(np.complex160(), np.complexfloating[_80Bit, _80Bit]) |
| 23 | +assert_type(np.complex192(), np.complexfloating[_96Bit, _96Bit]) |
| 24 | +assert_type(np.complex256(), np.complexfloating[_128Bit, _128Bit]) |
| 25 | +assert_type(np.complex512(), np.complexfloating[_256Bit, _256Bit]) |
0 commit comments