Back to index

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

List of all members.

Public Member Functions

def test_invalid_add_argument_group
def test_invalid_add_argument
def test_help
def assertEqual
def setUp

Detailed Description

Definition at line 2223 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.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 2241 of file test_argparse.py.

02241 
02242     def test_help(self):
02243         parser = ErrorRaisingArgumentParser(prog='PROG')
02244         group1 = parser.add_mutually_exclusive_group()
02245         group1.add_argument('--foo', action='store_true')
02246         group1.add_argument('--bar', action='store_false')
02247         group2 = parser.add_mutually_exclusive_group()
02248         group2.add_argument('--soup', action='store_true')
02249         group2.add_argument('--nuts', action='store_false')
02250         expected = '''\
02251             usage: PROG [-h] [--foo | --bar] [--soup | --nuts]
02252 
02253             optional arguments:
02254               -h, --help  show this help message and exit
02255               --foo
02256               --bar
02257               --soup
02258               --nuts
02259               '''
02260         self.assertEqual(parser.format_help(), textwrap.dedent(expected))

Here is the call graph for this function:

Definition at line 2230 of file test_argparse.py.

02230 
02231     def test_invalid_add_argument(self):
02232         parser = ErrorRaisingArgumentParser()
02233         group = parser.add_mutually_exclusive_group()
02234         add_argument = group.add_argument
02235         raises = self.assertRaises
02236         raises(ValueError, add_argument, '--foo', required=True)
02237         raises(ValueError, add_argument, 'bar')
02238         raises(ValueError, add_argument, 'bar', nargs='+')
02239         raises(ValueError, add_argument, 'bar', nargs=1)
02240         raises(ValueError, add_argument, 'bar', nargs=argparse.PARSER)

Here is the call graph for this function:

Definition at line 2225 of file test_argparse.py.

02225 
02226     def test_invalid_add_argument_group(self):
02227         parser = ErrorRaisingArgumentParser()
02228         raises = self.assertRaises
02229         raises(TypeError, parser.add_mutually_exclusive_group, title='foo')

Here is the call graph for this function:


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