Back to index

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

List of all members.

Public Member Functions

def do_test_no_exception
def do_test_exception
def test_nargs_None_metavar_string
def test_nargs_None_metavar_length0
def test_nargs_None_metavar_length1
def test_nargs_None_metavar_length2
def test_nargs_None_metavar_length3
def test_nargs_optional_metavar_string
def test_nargs_optional_metavar_length0
def test_nargs_optional_metavar_length1
def test_nargs_optional_metavar_length2
def test_nargs_optional_metavar_length3
def test_nargs_zeroormore_metavar_string
def test_nargs_zeroormore_metavar_length0
def test_nargs_zeroormore_metavar_length1
def test_nargs_zeroormore_metavar_length2
def test_nargs_zeroormore_metavar_length3
def test_nargs_oneormore_metavar_string
def test_nargs_oneormore_metavar_length0
def test_nargs_oneormore_metavar_length1
def test_nargs_oneormore_metavar_length2
def test_nargs_oneormore_metavar_length3
def test_nargs_remainder_metavar_string
def test_nargs_remainder_metavar_length0
def test_nargs_remainder_metavar_length1
def test_nargs_remainder_metavar_length2
def test_nargs_remainder_metavar_length3
def test_nargs_parser_metavar_string
def test_nargs_parser_metavar_length0
def test_nargs_parser_metavar_length1
def test_nargs_parser_metavar_length2
def test_nargs_parser_metavar_length3
def test_nargs_1_metavar_string
def test_nargs_1_metavar_length0
def test_nargs_1_metavar_length1
def test_nargs_1_metavar_length2
def test_nargs_1_metavar_length3
def test_nargs_2_metavar_string
def test_nargs_2_metavar_length0
def test_nargs_2_metavar_length1
def test_nargs_2_metavar_length2
def test_nargs_2_metavar_length3
def test_nargs_3_metavar_string
def test_nargs_3_metavar_length0
def test_nargs_3_metavar_length1
def test_nargs_3_metavar_length2
def test_nargs_3_metavar_length3
def assertEqual
def setUp

Static Public Attributes

string EXPECTED_MESSAGE = "length of metavar tuple does not match nargs"

Detailed Description

Definition at line 4480 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.TestAddArgumentMetavar.do_test_exception (   self,
  nargs,
  metavar 
)

Definition at line 4488 of file test_argparse.py.

04488 
04489     def do_test_exception(self, nargs, metavar):
04490         parser = argparse.ArgumentParser()
04491         with self.assertRaises(ValueError) as cm:
04492             parser.add_argument("--foo", nargs=nargs, metavar=metavar)
04493         self.assertEqual(cm.exception.args[0], self.EXPECTED_MESSAGE)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_argparse.TestAddArgumentMetavar.do_test_no_exception (   self,
  nargs,
  metavar 
)

Definition at line 4484 of file test_argparse.py.

04484 
04485     def do_test_no_exception(self, nargs, metavar):
04486         parser = argparse.ArgumentParser()
04487         parser.add_argument("--foo", nargs=nargs, metavar=metavar)

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 4601 of file test_argparse.py.

04601 
04602     def test_nargs_1_metavar_length0(self):
04603         self.do_test_exception(nargs=1, metavar=tuple())

Here is the call graph for this function:

Definition at line 4604 of file test_argparse.py.

04604 
04605     def test_nargs_1_metavar_length1(self):
04606         self.do_test_no_exception(nargs=1, metavar=("1"))

Here is the call graph for this function:

Definition at line 4607 of file test_argparse.py.

04607 
04608     def test_nargs_1_metavar_length2(self):
04609         self.do_test_exception(nargs=1, metavar=("1", "2"))

Here is the call graph for this function:

Definition at line 4610 of file test_argparse.py.

04610 
04611     def test_nargs_1_metavar_length3(self):
04612         self.do_test_exception(nargs=1, metavar=("1", "2", "3"))

Here is the call graph for this function:

Definition at line 4598 of file test_argparse.py.

04598 
04599     def test_nargs_1_metavar_string(self):
04600         self.do_test_no_exception(nargs=1, metavar="1")

Here is the call graph for this function:

Definition at line 4618 of file test_argparse.py.

04618 
04619     def test_nargs_2_metavar_length0(self):
04620         self.do_test_exception(nargs=2, metavar=tuple())

Here is the call graph for this function:

Definition at line 4621 of file test_argparse.py.

04621 
04622     def test_nargs_2_metavar_length1(self):
04623         self.do_test_no_exception(nargs=2, metavar=("1"))

Here is the call graph for this function:

Definition at line 4624 of file test_argparse.py.

04624 
04625     def test_nargs_2_metavar_length2(self):
04626         self.do_test_no_exception(nargs=2, metavar=("1", "2"))

Here is the call graph for this function:

Definition at line 4627 of file test_argparse.py.

04627 
04628     def test_nargs_2_metavar_length3(self):
04629         self.do_test_exception(nargs=2, metavar=("1", "2", "3"))

Here is the call graph for this function:

Definition at line 4615 of file test_argparse.py.

04615 
04616     def test_nargs_2_metavar_string(self):
04617         self.do_test_no_exception(nargs=2, metavar="1")

Here is the call graph for this function:

Definition at line 4635 of file test_argparse.py.

04635 
04636     def test_nargs_3_metavar_length0(self):
04637         self.do_test_exception(nargs=3, metavar=tuple())

Here is the call graph for this function:

Definition at line 4638 of file test_argparse.py.

04638 
04639     def test_nargs_3_metavar_length1(self):
04640         self.do_test_no_exception(nargs=3, metavar=("1"))

Here is the call graph for this function:

Definition at line 4641 of file test_argparse.py.

04641 
04642     def test_nargs_3_metavar_length2(self):
04643         self.do_test_exception(nargs=3, metavar=("1", "2"))

Here is the call graph for this function:

Definition at line 4644 of file test_argparse.py.

04644 
04645     def test_nargs_3_metavar_length3(self):
04646         self.do_test_no_exception(nargs=3, metavar=("1", "2", "3"))
04647 
04648 # ============================
04649 # from argparse import * tests
04650 # ============================

Here is the call graph for this function:

Definition at line 4632 of file test_argparse.py.

04632 
04633     def test_nargs_3_metavar_string(self):
04634         self.do_test_no_exception(nargs=3, metavar="1")

Here is the call graph for this function:

Definition at line 4499 of file test_argparse.py.

04499 
04500     def test_nargs_None_metavar_length0(self):
04501         self.do_test_exception(nargs=None, metavar=tuple())

Here is the call graph for this function:

Definition at line 4502 of file test_argparse.py.

04502 
04503     def test_nargs_None_metavar_length1(self):
04504         self.do_test_no_exception(nargs=None, metavar=("1"))

Here is the call graph for this function:

Definition at line 4505 of file test_argparse.py.

04505 
04506     def test_nargs_None_metavar_length2(self):
04507         self.do_test_exception(nargs=None, metavar=("1", "2"))

Here is the call graph for this function:

Definition at line 4508 of file test_argparse.py.

04508 
04509     def test_nargs_None_metavar_length3(self):
04510         self.do_test_exception(nargs=None, metavar=("1", "2", "3"))

Here is the call graph for this function:

Definition at line 4496 of file test_argparse.py.

04496 
04497     def test_nargs_None_metavar_string(self):
04498         self.do_test_no_exception(nargs=None, metavar="1")

Here is the call graph for this function:

Definition at line 4550 of file test_argparse.py.

04550 
04551     def test_nargs_oneormore_metavar_length0(self):
04552         self.do_test_exception(nargs="+", metavar=tuple())

Here is the call graph for this function:

Definition at line 4553 of file test_argparse.py.

04553 
04554     def test_nargs_oneormore_metavar_length1(self):
04555         self.do_test_no_exception(nargs="+", metavar=("1"))

Here is the call graph for this function:

Definition at line 4556 of file test_argparse.py.

04556 
04557     def test_nargs_oneormore_metavar_length2(self):
04558         self.do_test_no_exception(nargs="+", metavar=("1", "2"))

Here is the call graph for this function:

Definition at line 4559 of file test_argparse.py.

04559 
04560     def test_nargs_oneormore_metavar_length3(self):
04561         self.do_test_exception(nargs="+", metavar=("1", "2", "3"))

Here is the call graph for this function:

Definition at line 4547 of file test_argparse.py.

04547 
04548     def test_nargs_oneormore_metavar_string(self):
04549         self.do_test_no_exception(nargs="+", metavar="1")

Here is the call graph for this function:

Definition at line 4516 of file test_argparse.py.

04516 
04517     def test_nargs_optional_metavar_length0(self):
04518         self.do_test_exception(nargs="?", metavar=tuple())

Here is the call graph for this function:

Definition at line 4519 of file test_argparse.py.

04519 
04520     def test_nargs_optional_metavar_length1(self):
04521         self.do_test_no_exception(nargs="?", metavar=("1"))

Here is the call graph for this function:

Definition at line 4522 of file test_argparse.py.

04522 
04523     def test_nargs_optional_metavar_length2(self):
04524         self.do_test_exception(nargs="?", metavar=("1", "2"))

Here is the call graph for this function:

Definition at line 4525 of file test_argparse.py.

04525 
04526     def test_nargs_optional_metavar_length3(self):
04527         self.do_test_exception(nargs="?", metavar=("1", "2", "3"))

Here is the call graph for this function:

Definition at line 4513 of file test_argparse.py.

04513 
04514     def test_nargs_optional_metavar_string(self):
04515         self.do_test_no_exception(nargs="?", metavar="1")

Here is the call graph for this function:

Definition at line 4584 of file test_argparse.py.

04584 
04585     def test_nargs_parser_metavar_length0(self):
04586         self.do_test_exception(nargs="A...", metavar=tuple())

Here is the call graph for this function:

Definition at line 4587 of file test_argparse.py.

04587 
04588     def test_nargs_parser_metavar_length1(self):
04589         self.do_test_no_exception(nargs="A...", metavar=("1"))

Here is the call graph for this function:

Definition at line 4590 of file test_argparse.py.

04590 
04591     def test_nargs_parser_metavar_length2(self):
04592         self.do_test_exception(nargs="A...", metavar=("1", "2"))

Here is the call graph for this function:

Definition at line 4593 of file test_argparse.py.

04593 
04594     def test_nargs_parser_metavar_length3(self):
04595         self.do_test_exception(nargs="A...", metavar=("1", "2", "3"))

Here is the call graph for this function:

Definition at line 4581 of file test_argparse.py.

04581 
04582     def test_nargs_parser_metavar_string(self):
04583         self.do_test_no_exception(nargs="A...", metavar="1")

Here is the call graph for this function:

Definition at line 4567 of file test_argparse.py.

04567 
04568     def test_nargs_remainder_metavar_length0(self):
04569         self.do_test_no_exception(nargs="...", metavar=tuple())

Here is the call graph for this function:

Definition at line 4570 of file test_argparse.py.

04570 
04571     def test_nargs_remainder_metavar_length1(self):
04572         self.do_test_no_exception(nargs="...", metavar=("1"))

Here is the call graph for this function:

Definition at line 4573 of file test_argparse.py.

04573 
04574     def test_nargs_remainder_metavar_length2(self):
04575         self.do_test_no_exception(nargs="...", metavar=("1", "2"))

Here is the call graph for this function:

Definition at line 4576 of file test_argparse.py.

04576 
04577     def test_nargs_remainder_metavar_length3(self):
04578         self.do_test_no_exception(nargs="...", metavar=("1", "2", "3"))

Here is the call graph for this function:

Definition at line 4564 of file test_argparse.py.

04564 
04565     def test_nargs_remainder_metavar_string(self):
04566         self.do_test_no_exception(nargs="...", metavar="1")

Here is the call graph for this function:

Definition at line 4533 of file test_argparse.py.

04533 
04534     def test_nargs_zeroormore_metavar_length0(self):
04535         self.do_test_exception(nargs="*", metavar=tuple())

Here is the call graph for this function:

Definition at line 4536 of file test_argparse.py.

04536 
04537     def test_nargs_zeroormore_metavar_length1(self):
04538         self.do_test_no_exception(nargs="*", metavar=("1"))

Here is the call graph for this function:

Definition at line 4539 of file test_argparse.py.

04539 
04540     def test_nargs_zeroormore_metavar_length2(self):
04541         self.do_test_no_exception(nargs="*", metavar=("1", "2"))

Here is the call graph for this function:

Definition at line 4542 of file test_argparse.py.

04542 
04543     def test_nargs_zeroormore_metavar_length3(self):
04544         self.do_test_exception(nargs="*", metavar=("1", "2", "3"))

Here is the call graph for this function:

Definition at line 4530 of file test_argparse.py.

04530 
04531     def test_nargs_zeroormore_metavar_string(self):
04532         self.do_test_no_exception(nargs="*", metavar="1")

Here is the call graph for this function:


Member Data Documentation

string test.test_argparse.TestAddArgumentMetavar.EXPECTED_MESSAGE = "length of metavar tuple does not match nargs" [static]

Definition at line 4482 of file test_argparse.py.


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