Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_optparse Namespace Reference

Classes

class  InterceptedError
class  InterceptingOptionParser
class  BaseTest
class  TestOptionChecks
class  TestOptionParser
class  TestOptionValues
class  TestTypeAliases
class  DurationOption
class  TestDefaultValues
class  TestProgName
class  TestExpandDefaults
class  TestStandard
class  TestBool
class  TestChoice
class  TestCount
class  TestMultipleArgs
class  TestMultipleArgsAppend
class  TestVersion
class  TestConflictingDefaults
class  TestOptionGroup
class  TestExtendAddTypes
class  TestExtendAddActions
class  TestCallback
class  TestCallbackExtraArgs
class  TestCallbackMeddleArgs
class  TestCallbackManyArgs
class  TestCallbackCheckAbbrev
class  TestCallbackVarArgs
class  ConflictBase
class  TestConflict
class  TestConflictResolve
class  TestConflictOverride
class  TestHelp
class  TestMatchAbbrev
class  TestParseNumber

Functions

def _check_duration
def test_main

Variables

tuple retype = type(re.compile(''))
dictionary _time_units = { 's' : 1, 'm' : 60, 'h' : 60*60, 'd' : 60*60*24 }
string _expected_help_basic
string _expected_help_long_opts_first
string _expected_help_title_formatter
string _expected_help_short_lines

Function Documentation

def test.test_optparse._check_duration (   option,
  opt,
  value 
) [private]

Definition at line 438 of file test_optparse.py.

00438 
00439 def _check_duration(option, opt, value):
00440     try:
00441         if value[-1].isdigit():
00442             return int(value)
00443         else:
00444             return int(value[:-1]) * _time_units[value[-1]]
00445     except (ValueError, IndexError):
00446         raise OptionValueError(
00447             'option %s: invalid duration: %r' % (opt, value))

Here is the call graph for this function:

Definition at line 1601 of file test_optparse.py.

01601 
01602 def test_main():
01603     support.run_unittest(__name__)


Variable Documentation

Initial value:
00001 """\
00002 Usage: bar.py [options]
00003 
00004 Options:
00005   -a APPLE           throw APPLEs at basket
00006   -b NUM, --boo=NUM  shout "boo!" NUM times (in order to frighten away all the
00007                      evil spirits that cause trouble and mayhem)
00008   --foo=FOO          store FOO in the foo list for later fooing
00009   -h, --help         show this help message and exit
00010 """

Definition at line 1381 of file test_optparse.py.

Initial value:
00001 """\
00002 Usage: bar.py [options]
00003 
00004 Options:
00005   -a APPLE           throw APPLEs at basket
00006   --boo=NUM, -b NUM  shout "boo!" NUM times (in order to frighten away all the
00007                      evil spirits that cause trouble and mayhem)
00008   --foo=FOO          store FOO in the foo list for later fooing
00009   --help, -h         show this help message and exit
00010 """

Definition at line 1392 of file test_optparse.py.

Initial value:
00001 """\
00002 Usage: bar.py [options]
00003 
00004 Options:
00005   -a APPLE           throw APPLEs at basket
00006   -b NUM, --boo=NUM  shout "boo!" NUM times (in order to
00007                      frighten away all the evil spirits
00008                      that cause trouble and mayhem)
00009   --foo=FOO          store FOO in the foo list for later
00010                      fooing
00011   -h, --help         show this help message and exit
00012 """

Definition at line 1417 of file test_optparse.py.

Initial value:
00001 """\
00002 Usage
00003 =====
00004   bar.py [options]
00005 
00006 Options
00007 =======
00008 -a APPLE           throw APPLEs at basket
00009 --boo=NUM, -b NUM  shout "boo!" NUM times (in order to frighten away all the
00010                    evil spirits that cause trouble and mayhem)
00011 --foo=FOO          store FOO in the foo list for later fooing
00012 --help, -h         show this help message and exit
00013 """

Definition at line 1403 of file test_optparse.py.

dictionary test.test_optparse._time_units = { 's' : 1, 'm' : 60, 'h' : 60*60, 'd' : 60*60*24 }

Definition at line 436 of file test_optparse.py.

Definition at line 26 of file test_optparse.py.