Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_argparse.TestMutuallyExclusiveLongParent Class Reference
Inheritance diagram for test.test_argparse.TestMutuallyExclusiveLongParent:
Inheritance graph
[legend]
Collaboration diagram for test.test_argparse.TestMutuallyExclusiveLongParent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def get_parser
def get_parser
def test_failures_when_not_required
def test_failures_when_required
def test_successes_when_not_required
def test_successes_when_required
def test_usage_when_not_required
def test_usage_when_required
def test_help_when_not_required
def test_help_when_required
def assertEqual
def setUp

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

list failures = ['--klmno X --pqrst Y']
list successes
list successes_when_not_required
string usage_when_not_required
string usage_when_required
string help

Detailed Description

Definition at line 2648 of file test_argparse.py.


Member Function Documentation

def test.test_argparse.TestCase.assertEqual (   self,
  obj1,
  obj2 
) [inherited]

Definition at line 22 of file test_argparse.py.

00022 
00023     def assertEqual(self, obj1, obj2):
00024         if obj1 != obj2:
00025             print('')
00026             print(repr(obj1))
00027             print(repr(obj2))
00028             print(obj1)
00029             print(obj2)
00030         super(TestCase, self).assertEqual(obj1, obj2)

def test.test_argparse.TestMutuallyExclusiveLong.get_parser (   self,
  required = None 
) [inherited]

Definition at line 2346 of file test_argparse.py.

02346 
02347     def get_parser(self, required=None):
02348         parser = ErrorRaisingArgumentParser(prog='PROG')
02349         parser.add_argument('--abcde', help='abcde help')
02350         parser.add_argument('--fghij', help='fghij help')
02351         group = parser.add_mutually_exclusive_group(required=required)
02352         group.add_argument('--klmno', help='klmno help')
02353         group.add_argument('--pqrst', help='pqrst help')
02354         return parser

Here is the caller graph for this function:

def test.test_argparse.MEPBase.get_parser (   self,
  required = None 
) [inherited]

Definition at line 2630 of file test_argparse.py.

02630 
02631     def get_parser(self, required=None):
02632         parent = super(MEPBase, self).get_parser(required=required)
02633         parser = ErrorRaisingArgumentParser(
02634             prog=parent.prog, add_help=False, parents=[parent])
02635         return parser
02636 

Here is the caller graph for this function:

def test.test_argparse.TestCase.setUp (   self) [inherited]

Reimplemented in test.test_argparse.TestParentParsers, and test.test_argparse.TestAddSubparsers.

Definition at line 31 of file test_argparse.py.

00031 
00032     def setUp(self):
00033         # The tests assume that line wrapping occurs at 80 columns, but this
00034         # behaviour can be overridden by setting the COLUMNS environment
00035         # variable.  To ensure that this assumption is true, unset COLUMNS.
00036         env = support.EnvironmentVarGuard()
00037         env.unset("COLUMNS")
00038         self.addCleanup(env.__exit__)
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2263 of file test_argparse.py.

02263 
02264     def test_failures_when_not_required(self):
02265         parse_args = self.get_parser(required=False).parse_args
02266         error = ArgumentParserError
02267         for args_string in self.failures:
02268             self.assertRaises(error, parse_args, args_string.split())

Here is the call graph for this function:

Definition at line 2269 of file test_argparse.py.

02269 
02270     def test_failures_when_required(self):
02271         parse_args = self.get_parser(required=True).parse_args
02272         error = ArgumentParserError
02273         for args_string in self.failures + ['']:
02274             self.assertRaises(error, parse_args, args_string.split())

Here is the call graph for this function:

Definition at line 2298 of file test_argparse.py.

02298 
02299     def test_help_when_not_required(self):
02300         format_help = self.get_parser(required=False).format_help
02301         help = self.usage_when_not_required + self.help
02302         self.assertEqual(format_help(), textwrap.dedent(help))

Here is the call graph for this function:

Definition at line 2303 of file test_argparse.py.

02303 
02304     def test_help_when_required(self):
02305         format_help = self.get_parser(required=True).format_help
02306         help = self.usage_when_required + self.help
02307         self.assertEqual(format_help(), textwrap.dedent(help))
02308 

Here is the call graph for this function:

Definition at line 2275 of file test_argparse.py.

02275 
02276     def test_successes_when_not_required(self):
02277         parse_args = self.get_parser(required=False).parse_args
02278         successes = self.successes + self.successes_when_not_required
02279         for args_string, expected_ns in successes:
02280             actual_ns = parse_args(args_string.split())
02281             self.assertEqual(actual_ns, expected_ns)

Here is the call graph for this function:

Definition at line 2282 of file test_argparse.py.

02282 
02283     def test_successes_when_required(self):
02284         parse_args = self.get_parser(required=True).parse_args
02285         for args_string, expected_ns in self.successes:
02286             actual_ns = parse_args(args_string.split())
02287             self.assertEqual(actual_ns, expected_ns)

Here is the call graph for this function:

Definition at line 2288 of file test_argparse.py.

02288 
02289     def test_usage_when_not_required(self):
02290         format_usage = self.get_parser(required=False).format_usage
02291         expected_usage = self.usage_when_not_required
02292         self.assertEqual(format_usage(), textwrap.dedent(expected_usage))

Here is the call graph for this function:

Definition at line 2293 of file test_argparse.py.

02293 
02294     def test_usage_when_required(self):
02295         format_usage = self.get_parser(required=True).format_usage
02296         expected_usage = self.usage_when_required
02297         self.assertEqual(format_usage(), textwrap.dedent(expected_usage))

Here is the call graph for this function:


Member Data Documentation

list test.test_argparse.TestMutuallyExclusiveLong.failures = ['--klmno X --pqrst Y'] [static, inherited]

Definition at line 2355 of file test_argparse.py.

Initial value:
'''\

optional arguments:
  -h, --help     show this help message and exit
  --abcde ABCDE  abcde help
  --fghij FGHIJ  fghij help
  --klmno KLMNO  klmno help
  --pqrst PQRST  pqrst help
'''

Definition at line 2376 of file test_argparse.py.

Definition at line 107 of file object.h.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Initial value:
[
        ('--klmno X', NS(abcde=None, fghij=None, klmno='X', pqrst=None)),
        ('--abcde Y --klmno X',
            NS(abcde='Y', fghij=None, klmno='X', pqrst=None)),
        ('--pqrst X', NS(abcde=None, fghij=None, klmno=None, pqrst='X')),
        ('--pqrst X --fghij Y',
            NS(abcde=None, fghij='Y', klmno=None, pqrst='X')),
    ]

Definition at line 2356 of file test_argparse.py.

Initial value:
[
        ('', NS(abcde=None, fghij=None, klmno=None, pqrst=None)),
    ]

Definition at line 2364 of file test_argparse.py.

Initial value:
'''\
usage: PROG [-h] [--abcde ABCDE] [--fghij FGHIJ]
            [--klmno KLMNO | --pqrst PQRST]
'''

Definition at line 2368 of file test_argparse.py.

Initial value:
'''\
usage: PROG [-h] [--abcde ABCDE] [--fghij FGHIJ]
            (--klmno KLMNO | --pqrst PQRST)
'''

Definition at line 2372 of file test_argparse.py.


The documentation for this class was generated from the following file: