ConfigArgParse
ConfigArgParse copied to clipboard
Ability to support empty list with default parser?
I'm hoping to be able to use the default ArgumentParser (ie, not constrained by the INI format) and have it support a config that contains empty lists like this:
argument_name = []
Is this possible?
I tested this and it seems to already work as expected:
def test_issue_287(self):
"""
Add this as a unit test to one of the test classes
"""
self.initParser()
self.add_arg("--absent", nargs="*")
self.add_arg("--empty_list_in_conf", nargs="*")
config_lines = [ 'empty_list_in_conf = []' ]
ns = self.parse([], config_file_contents=("\n".join(config_lines)),
env_vars=dict())
self.assertEqual(vars(ns), { 'absent': None,
'empty_list_in_conf': [] })
If you still think this is an issue, please provide a code example.