|
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)]
|
20 |
| - v = _strictify(s).natural64.value |
21 |
| - assert (s == v).all() |
| 21 | + n = _strictify(s).natural64 |
| 22 | + assert n is not None |
| 23 | + v = n.value |
| 24 | + assert (s == v).all() # type: ignore[attr-defined] |
22 | 25 |
|
23 | 26 |
|
24 | 27 | def _unittest_strictify_u32() -> None:
|
25 | 28 | # noinspection PyProtectedMember
|
26 | 29 | from pycyphal.application.register._value import _strictify
|
27 | 30 |
|
28 | 31 | s = [x * 1000000 for x in range(60)]
|
29 |
| - v = _strictify(s).natural32.value |
30 |
| - assert (s == v).all() |
| 32 | + n = _strictify(s).natural32 |
| 33 | + assert n is not None |
| 34 | + v = n.value |
| 35 | + assert (s == v).all() # type: ignore[attr-defined] |
31 | 36 |
|
32 | 37 |
|
33 | 38 | def _unittest_strictify_u16() -> None:
|
34 | 39 | # noinspection PyProtectedMember
|
35 | 40 | from pycyphal.application.register._value import _strictify
|
36 | 41 |
|
37 | 42 | s = [x * 100 for x in range(80)]
|
38 |
| - v = _strictify(s).natural16.value |
39 |
| - assert (s == v).all() |
| 43 | + n = _strictify(s).natural16 |
| 44 | + assert n is not None |
| 45 | + v = n.value |
| 46 | + assert (s == v).all() # type: ignore[attr-defined] |
40 | 47 |
|
41 | 48 |
|
42 | 49 | def _unittest_strictify_i64() -> None:
|
43 | 50 | # noinspection PyProtectedMember
|
44 | 51 | from pycyphal.application.register._value import _strictify
|
45 | 52 |
|
46 | 53 | s = [-x * 1000000 for x in range(30)]
|
47 |
| - v = _strictify(s).integer64.value |
48 |
| - assert (s == v).all() |
| 54 | + n = _strictify(s).integer64 |
| 55 | + assert n is not None |
| 56 | + v = n.value |
| 57 | + assert (s == v).all() # type: ignore[attr-defined] |
49 | 58 |
|
50 | 59 |
|
51 | 60 | def _unittest_strictify_i32() -> None:
|
52 | 61 | # noinspection PyProtectedMember
|
53 | 62 | from pycyphal.application.register._value import _strictify
|
54 | 63 |
|
55 | 64 | s = [-x * 1000000 for x in range(60)]
|
56 |
| - v = _strictify(s).integer32.value |
57 |
| - assert (s == v).all() |
| 65 | + n = _strictify(s).integer32 |
| 66 | + assert n is not None |
| 67 | + v = n.value |
| 68 | + assert (s == v).all() # type: ignore[attr-defined] |
58 | 69 |
|
59 | 70 |
|
60 | 71 | def _unittest_strictify_i16() -> None:
|
61 | 72 | # noinspection PyProtectedMember
|
62 | 73 | from pycyphal.application.register._value import _strictify
|
63 | 74 |
|
64 | 75 | s = [-x * 100 for x in range(80)]
|
65 |
| - v = _strictify(s).integer16.value |
66 |
| - assert (s == v).all() |
| 76 | + n = _strictify(s).integer16 |
| 77 | + assert n is not None |
| 78 | + v = n.value |
| 79 | + assert (s == v).all() # type: ignore[attr-defined] |
0 commit comments