from optparse import Option, OptionParser, _match_abbrev
# This case-insensitive option parser relies on having a
# case-insensitive dictionary type available. Here's one
# for Python 2.2. Note that a *real* case-insensitive
# dictionary type would also have to implement __new__(),
# update(), and setdefault() -- but that's not the point
# of this exercise.
if __name__ == "__main__":
from optik.errors import OptionConflictError
# test 1: no options to start with
parser = CaselessOptionParser()
try:
parser.add_option("-H", dest="blah")
except OptionConflictError:
print "ok: got OptionConflictError for -H"
else:
print "not ok: no conflict between -h and -H"