Esempio n. 1
0
    def test_default_attributes(self):
        action = actions.Action(['--foo'], dests=['foo'])

        self.assertEqual(action.option_strings, ['--foo'])
        self.assertEqual(action.dests, ['foo'])
        self.assertEqual(action.const, None)
        self.assertEqual(action.default, None)
        self.assertEqual(action.type, None)
        self.assertEqual(action.choices, None)
        self.assertEqual(action.required, False)
        self.assertEqual(action.help, None)
        self.assertEqual(action.metavar, None)
        self.assertEqual(action.dest, SUPPRESS)
Esempio n. 2
0
    def test_call_not_implemented(self):
        action = actions.Action([], [])

        with self.assertRaises(NotImplementedError):
            action(None, None, None, None)
Esempio n. 3
0
    def test_supports_dest_argument(self):
        action = actions.Action([], [], dest='foo')

        self.assertEqual(action.dest, SUPPRESS)
Esempio n. 4
0
    def test_multiple_destinations(self):
        action = actions.Action(['--foo'], ['foo', 'bar'])

        self.assertEqual(action.dests, ['foo', 'bar'])
Esempio n. 5
0
    def test_single_destination(self):
        action = actions.Action(['--foo'], 'foo')

        self.assertEqual(action.dests, ['foo'])