# argparse_wrap_test.py - Test that causes an assertion error if the # metavar of an optional argument has # square/round brackets import argparse if __name__ == '__main__': parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description="An terrific web server" ) parser.add_argument( 'mandatory', metavar="", type=unicode, help="Name of the webserver" ) for i in xrange(5): parser.add_argument( '-%d' % i, '--bind%d' % i, metavar="[ip]:port", type=unicode, help="Helpful comment here for bind1" ) parser.parse_args()