def test_set_rule_option(self): config = LintConfig() # assert default title line-length self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 72) # change line length and assert it is set config.set_rule_option('title-max-length', 'line-length', 60) self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 60)
def test_set_rule_option(self): config = LintConfig() # assert default title line-length self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 72) # change line length and assert it is set config.set_rule_option('title-max-length', 'line-length', 60) self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 60)
def test_apply_config_options(self): config = LintConfig() # assert some defaults self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 72) self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 80) self.assertEqual(config.verbosity, 3) # change and assert changes config.apply_config_options(['general.verbosity=1', 'title-max-length.line-length=60', 'body-max-line-length.line-length=120']) self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 60) self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 120) self.assertEqual(config.verbosity, 1)
def test_apply_config_options(self): config = LintConfig() # assert some defaults self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 72) self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 80) self.assertEqual(config.verbosity, 3) # change and assert changes config.apply_config_options(['general.verbosity=1', 'title-max-length.line-length=60', 'body-max-line-length.line-length=120']) self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 60) self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 120) self.assertEqual(config.verbosity, 1)
def test_set_config_from_string_list(self): config = LintConfig() # change and assert changes config_builder = LintConfigBuilder() config_builder.set_config_from_string_list(['general.verbosity=1', 'title-max-length.line-length=60', 'body-max-line-length.line-length=120', "title-must-not-contain-word.words=håha"]) config = config_builder.build() self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 60) self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 120) self.assertListEqual(config.get_rule_option('title-must-not-contain-word', 'words'), ["håha"]) self.assertEqual(config.verbosity, 1)
def test_set_config_from_string_list(self): config = LintConfig() # assert some defaults self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 72) self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 80) self.assertEqual(config.verbosity, 3) # change and assert changes config_builder = LintConfigBuilder() config_builder.set_config_from_string_list(['general.verbosity=1', 'title-max-length.line-length=60', 'body-max-line-length.line-length=120']) config = config_builder.build() self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 60) self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 120) self.assertEqual(config.verbosity, 1)