215 lines
6.0 KiB
Python
215 lines
6.0 KiB
Python
from __future__ import annotations
|
|
|
|
settings_cases = [
|
|
(
|
|
(
|
|
("--test",),
|
|
dict(
|
|
action=None,
|
|
nargs=None,
|
|
const=None,
|
|
default=None,
|
|
type=None,
|
|
choices=None,
|
|
required=None,
|
|
help=None,
|
|
metavar=None,
|
|
dest=None,
|
|
cmdline=True,
|
|
file=True,
|
|
group="tst",
|
|
exclusive=False,
|
|
),
|
|
), # Equivalent to Setting("--test", group="tst")
|
|
{
|
|
"action": None,
|
|
"choices": None,
|
|
"cmdline": True,
|
|
"const": None,
|
|
"default": None,
|
|
"dest": "test", # dest is calculated by Setting and is not used by argparse
|
|
"exclusive": False,
|
|
"file": True,
|
|
"group": "tst",
|
|
"help": None,
|
|
"internal_name": "tst_test", # Should almost always be "{group}_{dest}"
|
|
"metavar": "TEST", # Set manually so argparse doesn't use TST_TEST
|
|
"nargs": None,
|
|
"required": None,
|
|
"type": None,
|
|
"argparse_args": ("--test",), # *args actually sent to argparse
|
|
"argparse_kwargs": {
|
|
"action": None,
|
|
"choices": None,
|
|
"const": None,
|
|
"default": None,
|
|
"dest": "tst_test",
|
|
"help": None,
|
|
"metavar": "TEST",
|
|
"nargs": None,
|
|
"required": None,
|
|
"type": None,
|
|
}, # Non-None **kwargs sent to argparse
|
|
},
|
|
),
|
|
(
|
|
(
|
|
(
|
|
"-t",
|
|
"--test",
|
|
),
|
|
dict(
|
|
action=None,
|
|
nargs=None,
|
|
const=None,
|
|
default=None,
|
|
type=None,
|
|
choices=None,
|
|
required=None,
|
|
help=None,
|
|
metavar=None,
|
|
dest=None,
|
|
cmdline=True,
|
|
file=True,
|
|
group="tst",
|
|
exclusive=False,
|
|
),
|
|
), # Equivalent to Setting("-t", "--test", group="tst")
|
|
{
|
|
"action": None,
|
|
"choices": None,
|
|
"cmdline": True,
|
|
"const": None,
|
|
"default": None,
|
|
"dest": "test",
|
|
"exclusive": False,
|
|
"file": True,
|
|
"group": "tst",
|
|
"help": None,
|
|
"internal_name": "tst_test",
|
|
"metavar": "TEST",
|
|
"nargs": None,
|
|
"required": None,
|
|
"type": None,
|
|
"argparse_args": (
|
|
"-t",
|
|
"--test",
|
|
), # Only difference with above is here
|
|
"argparse_kwargs": {
|
|
"action": None,
|
|
"choices": None,
|
|
"const": None,
|
|
"default": None,
|
|
"dest": "tst_test",
|
|
"help": None,
|
|
"metavar": "TEST",
|
|
"nargs": None,
|
|
"required": None,
|
|
"type": None,
|
|
},
|
|
},
|
|
),
|
|
(
|
|
(
|
|
("test",),
|
|
dict(
|
|
action=None,
|
|
nargs=None,
|
|
const=None,
|
|
default=None,
|
|
type=None,
|
|
choices=None,
|
|
required=None,
|
|
help=None,
|
|
metavar=None,
|
|
dest=None,
|
|
cmdline=True,
|
|
file=True,
|
|
group="tst",
|
|
exclusive=False,
|
|
),
|
|
), # Equivalent to Setting("test", group="tst")
|
|
{
|
|
"action": None,
|
|
"choices": None,
|
|
"cmdline": True,
|
|
"const": None,
|
|
"default": None,
|
|
"dest": "test",
|
|
"exclusive": False,
|
|
"file": True,
|
|
"group": "tst",
|
|
"help": None,
|
|
"internal_name": "tst_test",
|
|
"metavar": "TEST",
|
|
"nargs": None,
|
|
"required": None,
|
|
"type": None,
|
|
"argparse_args": ("tst_test",),
|
|
"argparse_kwargs": {
|
|
"action": None,
|
|
"choices": None,
|
|
"const": None,
|
|
"default": None,
|
|
"dest": None, # Only difference with #1 is here, argparse sets dest based on the *args passed to it
|
|
"help": None,
|
|
"metavar": "TEST",
|
|
"nargs": None,
|
|
"required": None,
|
|
"type": None,
|
|
},
|
|
},
|
|
),
|
|
(
|
|
(
|
|
("--test",),
|
|
dict(
|
|
action=None,
|
|
nargs=None,
|
|
const=None,
|
|
default=None,
|
|
type=None,
|
|
choices=None,
|
|
required=None,
|
|
help=None,
|
|
metavar=None,
|
|
dest=None,
|
|
cmdline=True,
|
|
file=True,
|
|
group="",
|
|
exclusive=False,
|
|
),
|
|
), # Equivalent to Setting("test")
|
|
{
|
|
"action": None,
|
|
"choices": None,
|
|
"cmdline": True,
|
|
"const": None,
|
|
"default": None,
|
|
"dest": "test",
|
|
"exclusive": False,
|
|
"file": True,
|
|
"group": "",
|
|
"help": None,
|
|
"internal_name": "test", # No group, leading _ is stripped
|
|
"metavar": "TEST",
|
|
"nargs": None,
|
|
"required": None,
|
|
"type": None,
|
|
"argparse_args": ("--test",),
|
|
"argparse_kwargs": {
|
|
"action": None,
|
|
"choices": None,
|
|
"const": None,
|
|
"default": None,
|
|
"dest": "test",
|
|
"help": None,
|
|
"metavar": "TEST",
|
|
"nargs": None,
|
|
"required": None,
|
|
"type": None,
|
|
},
|
|
},
|
|
),
|
|
]
|