|
1 | 1 | # Copyright (c) 2025 OpenCyphal
|
2 | 2 | # This software is distributed under the terms of the MIT License.
|
3 | 3 | # Author: Huong Pham <[email protected]>
|
| 4 | +from typing import List |
4 | 5 |
|
5 | 6 |
|
6 | 7 | def _unittest_strictify_bool() -> None:
|
7 | 8 | # noinspection PyProtectedMember
|
8 | 9 | from pycyphal.application.register._value import _strictify
|
9 | 10 |
|
10 | 11 | s = [True, False]
|
11 |
| - v = _strictify(s).bit.value |
12 |
| - assert (s == v).all() |
| 12 | + v: List[bool] = _strictify(s).bit.value |
| 13 | + assert (s == v).all() # type: ignore[attr-defined] |
13 | 14 |
|
14 | 15 |
|
15 | 16 | def _unittest_strictify_u64() -> None:
|
16 | 17 | # noinspection PyProtectedMember
|
17 | 18 | from pycyphal.application.register._value import _strictify
|
18 | 19 |
|
19 | 20 | s = [x * 1000000 for x in range(30)]
|
| 21 | + assert _strictify(s).natural64 is not None |
20 | 22 | v = _strictify(s).natural64.value
|
21 |
| - assert (s == v).all() |
| 23 | + assert (s == v).all() # type: ignore[attr-defined] |
22 | 24 |
|
23 | 25 |
|
24 | 26 | def _unittest_strictify_u32() -> None:
|
25 | 27 | # noinspection PyProtectedMember
|
26 | 28 | from pycyphal.application.register._value import _strictify
|
27 | 29 |
|
28 | 30 | s = [x * 1000000 for x in range(60)]
|
| 31 | + assert _strictify(s).natural32 is not None |
29 | 32 | v = _strictify(s).natural32.value
|
30 |
| - assert (s == v).all() |
| 33 | + assert (s == v).all() # type: ignore[attr-defined] |
31 | 34 |
|
32 | 35 |
|
33 | 36 | def _unittest_strictify_u16() -> None:
|
34 | 37 | # noinspection PyProtectedMember
|
35 | 38 | from pycyphal.application.register._value import _strictify
|
36 | 39 |
|
37 | 40 | s = [x * 100 for x in range(80)]
|
| 41 | + assert _strictify(s).natural16 is not None |
38 | 42 | v = _strictify(s).natural16.value
|
39 |
| - assert (s == v).all() |
| 43 | + assert (s == v).all() # type: ignore[attr-defined] |
40 | 44 |
|
41 | 45 |
|
42 | 46 | def _unittest_strictify_i64() -> None:
|
43 | 47 | # noinspection PyProtectedMember
|
44 | 48 | from pycyphal.application.register._value import _strictify
|
45 | 49 |
|
46 | 50 | s = [-x * 1000000 for x in range(30)]
|
| 51 | + assert _strictify(s).integer64 is not None |
47 | 52 | v = _strictify(s).integer64.value
|
48 |
| - assert (s == v).all() |
| 53 | + assert (s == v).all() # type: ignore[attr-defined] |
49 | 54 |
|
50 | 55 |
|
51 | 56 | def _unittest_strictify_i32() -> None:
|
52 | 57 | # noinspection PyProtectedMember
|
53 | 58 | from pycyphal.application.register._value import _strictify
|
54 | 59 |
|
55 | 60 | s = [-x * 1000000 for x in range(60)]
|
| 61 | + assert _strictify(s).integer32 is not None |
56 | 62 | v = _strictify(s).integer32.value
|
57 |
| - assert (s == v).all() |
| 63 | + assert (s == v).all() # type: ignore[attr-defined] |
58 | 64 |
|
59 | 65 |
|
60 | 66 | def _unittest_strictify_i16() -> None:
|
61 | 67 | # noinspection PyProtectedMember
|
62 | 68 | from pycyphal.application.register._value import _strictify
|
63 | 69 |
|
64 | 70 | s = [-x * 100 for x in range(80)]
|
| 71 | + assert _strictify(s).integer16 is not None |
65 | 72 | v = _strictify(s).integer16.value
|
66 |
| - assert (s == v).all() |
| 73 | + assert (s == v).all() # type: ignore[attr-defined] |
0 commit comments