1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
####################
# No args is an error
argparse: No option specs were provided
####################
# Missing -- is an error
argparse: Missing -- separator
####################
# Flags but no option specs is an error
argparse: No option specs were provided
####################
# Invalid option specs
argparse: Invalid option spec 'h-' at char '-'
argparse: Short flag '+' invalid, must be alphanum or '#'
argparse: Invalid option spec 'h/help:' at char ':'
argparse: Invalid option spec 'h-help::' at char ':'
argparse: Invalid option spec 'h-help=x' at char 'x'
####################
# --max-args and --min-args work
min-max: Expected at least 1 args, got only 0
min-max: Expected at most 3 args, got 4
min-max: Expected at most 1 args, got 2
####################
# Invalid "#-val" spec
argparse: Implicit int short flag '#' does not allow modifiers like '='
####################
# Invalid arg in the face of a "#-val" spec
argparse: Unknown option '-x'
Standard input (line 41):
argparse '#-val' -- abc -x def
^
####################
# Defining a short flag more than once
argparse: Short flag 's' already defined
####################
# Defining a long flag more than once
argparse: Long flag 'short' already defined
####################
# Defining an implicit int flag more than once
argparse: Implicit int flag '#' already defined
####################
# Defining an implicit int flag with modifiers
argparse: Implicit int short flag 'v' does not allow modifiers like '='
####################
# No args
####################
# One arg and no matching flags
####################
# Five args with two matching a flag
####################
# Required, optional, and multiple flags
####################
# --stop-nonopt works
####################
# Implicit int flags work
####################
# Should be set to 987
####################
# Should be set to 765
####################
# Bool short flag only
####################
# Value taking short flag only
####################
# Implicit int short flag only
####################
# Implicit int short flag only with custom validation passes
####################
# Implicit int short flag only with custom validation fails
argparse: Value '499' for flag 'x' less than min allowed of '500'
####################
# Implicit int flag validation fails
argparse: Value '765x' for flag 'max' is not an integer
argparse: Value 'a1' for flag 'm' is not an integer
####################
# Check the exit status from argparse validation
####################
# Explicit int flag validation
argparse: Value '2' for flag 'm' greater than max allowed of '1'
argparse: Value '-1' for flag 'max' less than min allowed of '0'
|