diff options
author | Mark De Ruyter <markdr@google.com> | 2019-10-24 18:02:15 -0700 |
---|---|---|
committer | Ang Li <angli@google.com> | 2019-10-24 18:02:15 -0700 |
commit | d919d5162bbcdfc94f85a7ec75e304ec2782a674 (patch) | |
tree | 9fe78b9dfcd73ee9240c178978db747607b41279 /tests/mobly/config_parser_test.py | |
parent | 378cc2805b84fcf7336d6bee64cad676971ceb19 (diff) | |
download | mobly-d919d5162bbcdfc94f85a7ec75e304ec2782a674.tar.gz |
Defaults the controller and user_params to empty dictionaries in TestRunConfig. (#654)
So users don't have to check for `None` when they access these fields.
Diffstat (limited to 'tests/mobly/config_parser_test.py')
-rw-r--r-- | tests/mobly/config_parser_test.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/mobly/config_parser_test.py b/tests/mobly/config_parser_test.py index 92450d1..59cd1d2 100644 --- a/tests/mobly/config_parser_test.py +++ b/tests/mobly/config_parser_test.py @@ -61,6 +61,20 @@ class OutputTest(unittest.TestCase): self.assertNotIn('summary_writer', str(config)) self.assertNotIn('register_controller', str(config)) + def test_run_config_controller_configs_is_already_initialized(self): + config = config_parser.TestRunConfig() + expected_value = 'SOME_VALUE' + self.assertEqual( + config.controller_configs.get('NON_EXISTENT_KEY', expected_value), + expected_value) + + def test_run_config_user_params_is_already_initialized(self): + config = config_parser.TestRunConfig() + expected_value = 'SOME_VALUE' + self.assertEqual( + config.user_params.get('NON_EXISTENT_KEY', expected_value), + expected_value) + if __name__ == '__main__': unittest.main() |