Back to index

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

List of all members.

Public Member Functions

def test_optionals
def test_mixed
def assertEqual
def setUp

Detailed Description

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

04465 
04466     def test_mixed(self):
04467         parser = argparse.ArgumentParser()
04468         parser.add_argument('-v', nargs='?', const=1, type=int)
04469         parser.add_argument('--spam', action='store_false')
04470         parser.add_argument('badger')
04471 
04472         argv = ["B", "C", "--foo", "-v", "3", "4"]
04473         args, extras = parser.parse_known_args(argv)
04474         self.assertEqual(NS(v=3, spam=True, badger="B"), args)
04475         self.assertEqual(["C", "--foo", "4"], extras)
04476 
04477 # ==========================
04478 # add_argument metavar tests
04479 # ==========================

Here is the call graph for this function:

Definition at line 4458 of file test_argparse.py.

04458 
04459     def test_optionals(self):
04460         parser = argparse.ArgumentParser()
04461         parser.add_argument('--foo')
04462         args, extras = parser.parse_known_args('--foo F --bar --baz'.split())
04463         self.assertEqual(NS(foo='F'), args)
04464         self.assertEqual(['--bar', '--baz'], extras)

Here is the call graph for this function:


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