def METHOD_NAME(self):
    # note: the empty string between '-a' and '--beta' is significant:
    # it simulates an empty string option argument ('-a ""') on the
    # command line.
    cmdline = ['-a', '1', '-b', '--alpha=2', '--beta', '-a', '3', '-a',
               '', '--beta', 'arg1', 'arg2']
    opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta'])
    self.assertEqual(opts, [('-a', '1'), ('-b', ''),
                            ('--alpha', '2'), ('--beta', ''),
                            ('-a', '3'), ('-a', ''), ('--beta', '')])
    # Note ambiguity of ('-b', '') and ('-a', '') above. This must be
    # accounted for in the code that calls getopt().
    self.assertEqual(args, ['arg1', 'arg2'])
    self.assertError(getopt.getopt, cmdline, 'a:b', ['alpha', 'beta'])