diff --git a/gooey/tests/test_argparse_to_json.py b/gooey/tests/test_argparse_to_json.py index 1d50c225..cd90c38b 100644 --- a/gooey/tests/test_argparse_to_json.py +++ b/gooey/tests/test_argparse_to_json.py @@ -184,6 +184,8 @@ def test_textinput_with_list_default_mapped_to_cli_friendly_value(self): Using nargs and a `default` value with a list causes the literal list string to be put into the UI. + + Also tests initial_value - see issue #756. """ testcases = [ {'nargs': '+', 'default': ['a b', 'c'], 'gooey_default': '"a b" "c"', 'w': 'TextField'}, @@ -216,6 +218,13 @@ def test_textinput_with_list_default_mapped_to_cli_friendly_value(self): result = argparse_to_json.handle_initial_values(action, case['w'], action.default) self.assertEqual(result, case['gooey_default']) + gooey_parser = GooeyParser(prog='test_program') + options = {'initial_value': case['default']} + gooey_parser.add_argument('--foo', nargs=case['nargs'], gooey_options=options) + action = gooey_parser._actions[-1] + result = argparse_to_json.handle_initial_values(action, case['w'], case['default']) + self.assertEqual(result, case['gooey_default']) + def test_nargs(self): """ so there are just a few simple rules here: