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