diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2021-06-14 15:36:16 -0700 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2021-06-22 09:12:54 -0700 |
| commit | dd296f321ba102052dcf3d0a67e4321752d560a2 (patch) | |
| tree | 128a96df875cdcde36e3e647ec605866b5563270 /run_unittests.py | |
| parent | a024f432dd1cd406fa80334f63e91939536d3f79 (diff) | |
| download | meson-dd296f321ba102052dcf3d0a67e4321752d560a2.tar.gz | |
interpreterbase: Add evolve to KwargInfo
This works just like OptionKey.evolve, pass new keyword arguments to
override old ones, otherwise the original versions are copied to the new
one.
Diffstat (limited to 'run_unittests.py')
| -rwxr-xr-x | run_unittests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index b55ba96f6..6ca1a81da 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1698,6 +1698,18 @@ class InternalTests(unittest.TestCase): _(None, mock.Mock(subproject=''), [], {'mode': 'since'}) self.assertRegex(out.getvalue(), r"""WARNING:.Project targeting '1.0'.*introduced in '1.1': "testfunc" keyword argument "mode" value "since".*""") + def test_typed_kwarg_evolve(self) -> None: + k = KwargInfo('foo', str, required=True, default='foo') + v = k.evolve(default='bar') + self.assertEqual(k.name, 'foo') + self.assertEqual(k.name, v.name) + self.assertEqual(k.types, str) + self.assertEqual(k.types, v.types) + self.assertEqual(k.required, True) + self.assertEqual(k.required, v.required) + self.assertEqual(k.default, 'foo') + self.assertEqual(v.default, 'bar') + @unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release') class DataTests(unittest.TestCase): |
