示例#1
0
    def test_add_duplicate_shortcut_option(self):
        self.initialize_options()

        definition = InputDefinition()
        definition.add_option(self.foo)
        self.assertRaisesRegexp(
            Exception, 'An option with shortcut "f" already exists.', definition.add_option, self.foo1
        )
示例#2
0
    def test_add_option(self):
        self.initialize_options()

        definition = InputDefinition()
        definition.add_option(self.foo)
        self.assertEqual([self.foo], definition.get_options())
        definition.add_option(self.bar)
        self.assertEqual([self.foo, self.bar], definition.get_options())
示例#3
0
    def test_add_option(self):
        self.initialize_options()

        definition = InputDefinition()
        definition.add_option(self.foo)
        self.assertEqual([self.foo], definition.get_options())
        definition.add_option(self.bar)
        self.assertEqual([self.foo, self.bar], definition.get_options())
示例#4
0
    def test_add_duplicate_shortcut_option(self):
        self.initialize_options()

        definition = InputDefinition()
        definition.add_option(self.foo)
        self.assertRaisesRegexp(Exception,
                                'An option with shortcut "f" already exists.',
                                definition.add_option, self.foo1)
示例#5
0
    def test_add_duplicate_option(self):
        self.initialize_options()

        definition = InputDefinition()
        definition.add_option(self.foo)
        self.assertRaisesRegexp(Exception,
                                'An option named "foo" already exists.',
                                definition.add_option, self.foo2)
示例#6
0
    def test_add_duplicate_option(self):
        self.initialize_options()

        definition = InputDefinition()
        definition.add_option(self.foo)
        self.assertRaisesRegexp(Exception, 'An option named "foo" already exists.', definition.add_option, self.foo2)