mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
*: Utilize newer 3.10 syntax for type hints
Tests: - mypy does not show any errors. - Installing ejabberd app works. Privileged actions run fine. - Unit tests work. - No additional testing was done as type annotations don't have any effect at runtime. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
a86a86d605
commit
38ece87c6c
29 files changed
+116
-140
No files matched your search
@@ -147,9 +147,9 @@ def test_assert_valid_type(actions_module):
|
||||
|
||||
# Invalid values for int, str, float and Optional
|
||||
values = [[1, bool], ['foo', int], [1, str], [1, float],
|
||||
[1, typing.Optional[str]], [1.1, typing.Union[int, str]],
|
||||
[1, list], [1, dict], [[1], list[str]],
|
||||
[{
|
||||
[1, typing.Optional[str]], [1, str | None],
|
||||
[1.1, typing.Union[int, str]], [1.1, int | str], [1, list],
|
||||
[1, dict], [[1], list[str]], [{
|
||||
'a': 'b'
|
||||
}, dict[int, str]], [{
|
||||
1: 2
|
||||
@@ -165,8 +165,12 @@ def test_assert_valid_type(actions_module):
|
||||
assert_valid('arg', 1.1, float)
|
||||
assert_valid('arg', None, typing.Optional[int])
|
||||
assert_valid('arg', 1, typing.Optional[int])
|
||||
assert_valid('arg', None, int | None)
|
||||
assert_valid('arg', 1, int | None)
|
||||
assert_valid('arg', 1, typing.Union[int, str])
|
||||
assert_valid('arg', '1', typing.Union[int, str])
|
||||
assert_valid('arg', 1, int | str)
|
||||
assert_valid('arg', '1', int | str)
|
||||
assert_valid('arg', [], list[int])
|
||||
assert_valid('arg', ['foo'], list[str])
|
||||
assert_valid('arg', {}, dict[int, str])
|
||||
|
||||
Reference in new issue
Block a user