Back to index

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

List of all members.

Public Member Functions

def test_bad_type
def test_conflict_error
def test_resolve_error
def assertEqual
def setUp

Detailed Description

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

04189 
04190     def test_bad_type(self):
04191         self.assertRaises(ValueError, argparse.ArgumentParser,
04192                           conflict_handler='foo')

Here is the call graph for this function:

Definition at line 4193 of file test_argparse.py.

04193 
04194     def test_conflict_error(self):
04195         parser = argparse.ArgumentParser()
04196         parser.add_argument('-x')
04197         self.assertRaises(argparse.ArgumentError,
04198                           parser.add_argument, '-x')
04199         parser.add_argument('--spam')
04200         self.assertRaises(argparse.ArgumentError,
04201                           parser.add_argument, '--spam')

Here is the call graph for this function:

Definition at line 4202 of file test_argparse.py.

04202 
04203     def test_resolve_error(self):
04204         get_parser = argparse.ArgumentParser
04205         parser = get_parser(prog='PROG', conflict_handler='resolve')
04206 
04207         parser.add_argument('-x', help='OLD X')
04208         parser.add_argument('-x', help='NEW X')
04209         self.assertEqual(parser.format_help(), textwrap.dedent('''\
04210             usage: PROG [-h] [-x X]
04211 
04212             optional arguments:
04213               -h, --help  show this help message and exit
04214               -x X        NEW X
04215             '''))
04216 
04217         parser.add_argument('--spam', metavar='OLD_SPAM')
04218         parser.add_argument('--spam', metavar='NEW_SPAM')
04219         self.assertEqual(parser.format_help(), textwrap.dedent('''\
04220             usage: PROG [-h] [-x X] [--spam NEW_SPAM]
04221 
04222             optional arguments:
04223               -h, --help       show this help message and exit
04224               -x X             NEW X
04225               --spam NEW_SPAM
04226             '''))
04227 
04228 
04229 # =============================
04230 # Help and Version option tests
04231 # =============================

Here is the call graph for this function:


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