|
1 | 1 | from typing_extensions import assert_type |
2 | 2 |
|
3 | 3 | import numpy as np |
4 | | -import numpy.typing as npt |
5 | 4 |
|
6 | 5 | ### |
7 | 6 |
|
8 | | -b: bool |
9 | | -i: int |
10 | | - |
11 | 7 | b1: np.bool |
12 | 8 | i4: np.int32 |
13 | 9 | u4: np.uint32 |
14 | 10 | i8: np.int64 |
15 | 11 | u8: np.uint64 |
16 | 12 |
|
17 | | -i4_nd: npt.NDArray[np.int32] |
18 | | - |
19 | 13 | ### |
20 | 14 |
|
21 | | -assert_type(i8 | i8, np.int64) |
22 | | -assert_type(i8 ^ i8, np.int64) |
23 | | -assert_type(i8 & i8, np.int64) |
24 | | - |
25 | | -assert_type(i8 | i4_nd, npt.NDArray[np.signedinteger]) |
26 | | -assert_type(i8 ^ i4_nd, npt.NDArray[np.signedinteger]) |
27 | | -assert_type(i8 & i4_nd, npt.NDArray[np.signedinteger]) |
28 | | - |
29 | | -assert_type(i4 | i4, np.int32) |
30 | | -assert_type(i4 ^ i4, np.int32) |
31 | | -assert_type(i4 & i4, np.int32) |
32 | | - |
33 | | -assert_type(i8 | i4, np.int64) |
34 | | -assert_type(i8 ^ i4, np.int64) |
35 | | -assert_type(i8 & i4, np.int64) |
36 | | - |
37 | | -assert_type(i8 | b1, np.int64) |
38 | | -assert_type(i8 ^ b1, np.int64) |
39 | | -assert_type(i8 & b1, np.int64) |
40 | | - |
41 | | -assert_type(i8 | b, np.int64) |
42 | | -assert_type(i8 ^ b, np.int64) |
43 | | -assert_type(i8 & b, np.int64) |
44 | | - |
45 | | -assert_type(u8 | u8, np.uint64) |
46 | | -assert_type(u8 ^ u8, np.uint64) |
47 | | -assert_type(u8 & u8, np.uint64) |
48 | | - |
49 | | -assert_type(u4 | u4, np.uint32) |
50 | | -assert_type(u4 ^ u4, np.uint32) |
51 | | -assert_type(u4 & u4, np.uint32) |
52 | | - |
53 | | -assert_type(u4 | i4, np.int64) |
54 | | -assert_type(u4 ^ i4, np.int64) |
55 | | -assert_type(u4 & i4, np.int64) |
56 | | - |
57 | | -assert_type(u4 | i, np.uint32) |
58 | | -assert_type(u4 ^ i, np.uint32) |
59 | | -assert_type(u4 & i, np.uint32) |
60 | | - |
61 | | -assert_type(u8 | b1, np.uint64) |
62 | | -assert_type(u8 ^ b1, np.uint64) |
63 | | -assert_type(u8 & b1, np.uint64) |
64 | | - |
65 | | -assert_type(u8 | b, np.uint64) |
66 | | -assert_type(u8 ^ b, np.uint64) |
67 | | -assert_type(u8 & b, np.uint64) |
68 | | - |
69 | | -assert_type(b1 | b1, np.bool) |
70 | | -assert_type(b1 ^ b1, np.bool) |
71 | | -assert_type(b1 & b1, np.bool) |
72 | | - |
73 | | -assert_type(b1 | i4_nd, npt.NDArray[np.signedinteger]) |
74 | | -assert_type(b1 ^ i4_nd, npt.NDArray[np.signedinteger]) |
75 | | -assert_type(b1 & i4_nd, npt.NDArray[np.signedinteger]) |
76 | | - |
77 | | -assert_type(b1 | b, np.bool) |
78 | | -assert_type(b1 ^ b, np.bool) |
79 | | -assert_type(b1 & b, np.bool) |
80 | | - |
81 | | -assert_type(b1 | i, np.intp) |
82 | | -assert_type(b1 ^ i, np.intp) |
83 | | -assert_type(b1 & i, np.intp) |
84 | | - |
85 | | -assert_type(~i8, np.int64) |
| 15 | +assert_type(~b1, np.bool) |
86 | 16 | assert_type(~i4, np.int32) |
87 | | -assert_type(~u8, np.uint64) |
88 | 17 | assert_type(~u4, np.uint32) |
89 | | -assert_type(~b1, np.bool) |
| 18 | +assert_type(~i8, np.int64) |
| 19 | +assert_type(~u8, np.uint64) |
0 commit comments