Created
September 30, 2016 11:48
-
-
Save Alphadelta14/ade8d24b645d43c85e03c5186d3576c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_parseable(): | |
parser = ArgumentPasserParser() | |
parser.add_optional_bool('-n') | |
parser.add_optional_bool('--rm') | |
parser.add_optional_bool('--detach') | |
parser.add_optional_bool('--interactive') | |
parser.add_argument('image') | |
parser.add_argument('command', nargs=argparse.REMAINDER) | |
args = parser.parse_args(['--interactive', | |
'--rm', 'true', | |
'-e', 'TEST1=1', | |
'-e', 'TEST2=2', | |
'--detach', 'false', | |
'--something', 'else', | |
'my.image', | |
'echo', '-n', 'hello', 'world']) | |
assert args['--something'] == 'else' | |
assert args['image'] == 'my.image' | |
assert args['command'] == ['echo', '-n', 'hello', 'world'] | |
assert not args.get('-n') | |
assert args['--rm'] | |
assert args['--interactive'] | |
assert not args['--detach'] | |
assert args.all_values('-e') == ['TEST1=1', 'TEST2=2'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment