aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 9f66d9c..21bb30e 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1644,6 +1644,16 @@ class InternalTests(unittest.TestCase):
_(None, mock.Mock(), tuple(), dict(input='bar'))
self.assertEqual(str(cm.exception), "testfunc keyword argument \"input\" invalid!")
+ def test_typed_kwarg_convertor(self) -> None:
+ @typed_kwargs(
+ 'testfunc',
+ KwargInfo('native', bool, convertor=lambda n: MachineChoice.BUILD if n else MachineChoice.HOST)
+ )
+ def _(obj, node, args: T.Tuple, kwargs: T.Dict[str, MachineChoice]) -> None:
+ assert isinstance(kwargs['native'], MachineChoice)
+
+ _(None, mock.Mock(), tuple(), dict(native=True))
+
@unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release')
class DataTests(unittest.TestCase):