def test_parses_less_simple_comma_separated_lists(self):
        value = option_normalizer('F401 ,F402 ,F403 ,F404, F405', self.option,
                                  self.option_name)
        self.assertEqual(value, self.answer)

        value = option_normalizer('F401, F402, F403, F404, F405', self.option,
                                  self.option_name)
        self.assertEqual(value, self.answer)
Esempio n. 2
0
    def test_parses_less_simple_comma_separated_lists(self):
        value = option_normalizer('F401 ,F402 ,F403 ,F404', self.option,
                                  self.option_name)
        self.assertEqual(value, self.answer)

        value = option_normalizer('F401, F402, F403, F404', self.option,
                                  self.option_name)
        self.assertEqual(value, self.answer)
Esempio n. 3
0
 def test_parses_comma_separated_lists_with_newlines(self):
     value = option_normalizer('''\
         F401,
         F402,
         F403,
         F404,
     ''', self.option, self.option_name)
     self.assertEqual(value, self.answer)
Esempio n. 4
0
    def test_parses_lists(self):
        answer = ['F401', 'F402', 'F403', 'F404']

        option = option_normalizer('F401,F402,F403,F404')
        self.assertEqual(option, answer)

        option = option_normalizer('F401 ,F402 ,F403 ,F404')
        self.assertEqual(option, answer)

        option = option_normalizer('F401, F402, F403, F404')
        self.assertEqual(option, answer)

        option = option_normalizer('''\
            F401,
            F402,
            F403,
            F404,
        ''')
        self.assertEqual(option, answer)
Esempio n. 5
0
    def test_parses_lists(self):
        answer = ['F401', 'F402', 'F403', 'F404']

        option = option_normalizer('F401,F402,F403,F404')
        self.assertEqual(option, answer)

        option = option_normalizer('F401 ,F402 ,F403 ,F404')
        self.assertEqual(option, answer)

        option = option_normalizer('F401, F402, F403, F404')
        self.assertEqual(option, answer)

        option = option_normalizer('''\
            F401,
            F402,
            F403,
            F404,
        ''')
        self.assertEqual(option, answer)
Esempio n. 6
0
    def finalize_options(self):
        self.options_dict = {}
        for (option_name, opt) in self.option_to_cmds.items():
            if option_name in ['help', 'verbose']:
                continue
            value = getattr(self, option_name)
            if value is None:
                continue
            value = option_normalizer(value, opt, option_name)
            # Check if there's any values that need to be fixed.
            if option_name == "include" and isinstance(value, str):
                value = re.findall('[^,;\s]+', value)

            self.options_dict[option_name] = value
Esempio n. 7
0
    def finalize_options(self):
        self.options_dict = {}
        for (option_name, opt) in self.option_to_cmds.items():
            if option_name in ['help', 'verbose']:
                continue
            value = getattr(self, option_name)
            if value is None:
                continue
            value = option_normalizer(value, opt, option_name)
            # Check if there's any values that need to be fixed.
            if option_name == "include" and isinstance(value, str):
                value = re.findall('[^,;\s]+', value)

            self.options_dict[option_name] = value
Esempio n. 8
0
 def test_on_is_true(self):
     value = option_normalizer('on', self.option, self.option_name)
     self.assertTrue(value)
Esempio n. 9
0
 def test_off_is_false(self):
     option = option_normalizer('off')
     self.assertFalse(option)
Esempio n. 10
0
 def test_OFF_is_false(self):
     value = option_normalizer('OFF', self.option, self.option_name)
     self.assertFalse(value)
Esempio n. 11
0
 def test_1_is_true(self):
     option = option_normalizer('1')
     self.assertTrue(option)
Esempio n. 12
0
 def test_false_is_false(self):
     option = option_normalizer('false')
     self.assertFalse(option)
Esempio n. 13
0
 def test_FALSE_is_false(self):
     option = option_normalizer('FALSE')
     self.assertFalse(option)
Esempio n. 14
0
import optparse
Esempio n. 15
0
 def test_off_is_false(self):
     value = option_normalizer('off', self.option, self.option_name)
     self.assertFalse(value)
Esempio n. 16
0
 def test_OFF_is_false(self):
     value = option_normalizer('OFF', self.option, self.option_name)
     self.assertFalse(value)
Esempio n. 17
0
 def test_FALSE_is_false(self):
     value = option_normalizer('FALSE', self.option, self.option_name)
     self.assertFalse(value)
Esempio n. 18
0
 def test_on_is_true(self):
     value = option_normalizer('on', self.option, self.option_name)
     self.assertTrue(value)
Esempio n. 19
0
 def test_TRUE_is_true(self):
     value = option_normalizer('TRUE', self.option, self.option_name)
     self.assertTrue(value, True)
Esempio n. 20
0
 def test_parses_an_int(self):
     value = option_normalizer('2', self.option, self.option_name)
     self.assertEqual(value, 2)
Esempio n. 21
0
 def test_1_is_true(self):
     option = option_normalizer('1')
     self.assertTrue(option)
Esempio n. 22
0
 def test_FALSE_is_false(self):
     value = option_normalizer('FALSE', self.option, self.option_name)
     self.assertFalse(value)
Esempio n. 23
0
# -*- coding: utf-8 -*-
Esempio n. 24
0
 def test_TRUE_is_true(self):
     option = option_normalizer('TRUE')
     self.assertTrue(option, True)
Esempio n. 25
0
 def test_TRUE_is_true(self):
     value = option_normalizer('TRUE', self.option, self.option_name)
     self.assertTrue(value, True)
Esempio n. 26
0
 def test_OFF_is_false(self):
     option = option_normalizer('OFF')
     self.assertFalse(option)
Esempio n. 27
0
 def test_OFF_is_false(self):
     option = option_normalizer('OFF')
     self.assertFalse(option)
Esempio n. 28
0
 def test_off_is_false(self):
     option = option_normalizer('off')
     self.assertFalse(option)
Esempio n. 29
0
 def test_false_is_false(self):
     option = option_normalizer('false')
     self.assertFalse(option)
Esempio n. 30
0
 def test_TRUE_is_true(self):
     option = option_normalizer('TRUE')
     self.assertTrue(option, True)
Esempio n. 31
0
 def test_off_is_false(self):
     value = option_normalizer('off', self.option, self.option_name)
     self.assertFalse(value)
Esempio n. 32
0
 def test_FALSE_is_false(self):
     option = option_normalizer('FALSE')
     self.assertFalse(option)
Esempio n. 33
0
 def test_parses_an_int(self):
     value = option_normalizer('2', self.option, self.option_name)
     self.assertEqual(value, 2)