Skip to content

Commit 6e8005c

Browse files
committed
fix mypy
1 parent b0109c9 commit 6e8005c

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed
Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,79 @@
11
# Copyright (c) 2025 OpenCyphal
22
# This software is distributed under the terms of the MIT License.
33
# Author: Huong Pham <[email protected]>
4+
from typing import List
45

56

67
def _unittest_strictify_bool() -> None:
78
# noinspection PyProtectedMember
89
from pycyphal.application.register._value import _strictify
910

1011
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]
1314

1415

1516
def _unittest_strictify_u64() -> None:
1617
# noinspection PyProtectedMember
1718
from pycyphal.application.register._value import _strictify
1819

1920
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]
2225

2326

2427
def _unittest_strictify_u32() -> None:
2528
# noinspection PyProtectedMember
2629
from pycyphal.application.register._value import _strictify
2730

2831
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]
3136

3237

3338
def _unittest_strictify_u16() -> None:
3439
# noinspection PyProtectedMember
3540
from pycyphal.application.register._value import _strictify
3641

3742
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]
4047

4148

4249
def _unittest_strictify_i64() -> None:
4350
# noinspection PyProtectedMember
4451
from pycyphal.application.register._value import _strictify
4552

4653
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]
4958

5059

5160
def _unittest_strictify_i32() -> None:
5261
# noinspection PyProtectedMember
5362
from pycyphal.application.register._value import _strictify
5463

5564
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]
5869

5970

6071
def _unittest_strictify_i16() -> None:
6172
# noinspection PyProtectedMember
6273
from pycyphal.application.register._value import _strictify
6374

6475
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

Comments
 (0)