def test_extract_aspects_from_section(self): section = Section('section') section.append(Setting( 'aspects', 'spelling, commitmessage, methodsmell')) # Custom taste for ColonExistence section.append(Setting('commitmessage:shortlog_colon', 'false')) section.language = Language['py 3.4'] aspects = extract_aspects_from_section(section) spelling_instance = Root.Spelling('py 3.4') colon_existence_instance = ( Root.Metadata.CommitMessage.Shortlog.ColonExistence( 'py 3.4', shortlog_colon=False)) method_smell_instance = Root.Smell.MethodSmell('py 3.4') trailing_period_instance = ( Root.Metadata.CommitMessage.Shortlog.TrailingPeriod('py 3.4')) self.assertIsInstance(aspects, AspectList) self.assertEqual(aspects.get('spelling'), spelling_instance) self.assertEqual(aspects.get('colonexistence'), colon_existence_instance) self.assertEqual(aspects.get('methodsmell'), method_smell_instance) self.assertEqual(aspects.get('TrailingPeriod'), trailing_period_instance)
def test_extract_aspects_from_section_with_exclude(self): section = Section('section') section.append(Setting('aspects', 'commitmessage')) section.append(Setting('excludes', 'TrailingPeriod')) section.language = Language['py 3.4'] aspects = extract_aspects_from_section(section) self.assertTrue(issubaspect(get_aspect('trailingperiod'), get_aspect('commitmessage'))) self.assertIsNone(aspects.get('trailingperiod'))
def test_extract_aspects_from_section_with_exclude(self): section = Section('section') section.append(Setting('aspects', 'commitmessage')) section.append(Setting('excludes', 'TrailingPeriod')) section.language = Language['py 3.4'] aspects = extract_aspects_from_section(section) self.assertTrue( issubaspect(get_aspect('trailingperiod'), get_aspect('commitmessage'))) self.assertIsNone(aspects.get('trailingperiod'))
def test_extract_aspects_from_section(self): section = Section('section') section.append( Setting('aspects', 'spelling, commitmessage, methodsmell')) # Custom taste for ColonExistence section.append(Setting('commitmessage:shortlog_colon', 'false')) section.language = Language['py 3.4'] aspects = extract_aspects_from_section(section) spelling_instance = Root.Spelling('py 3.4') colon_existence_instance = ( Root.Metadata.CommitMessage.Shortlog.ColonExistence( 'py 3.4', shortlog_colon=False)) method_smell_instance = Root.Smell.MethodSmell('py 3.4') trailing_period_instance = ( Root.Metadata.CommitMessage.Shortlog.TrailingPeriod('py 3.4')) self.assertIsInstance(aspects, AspectList) self.assertEqual(aspects.get('spelling'), spelling_instance) self.assertEqual(aspects.get('colonexistence'), colon_existence_instance) self.assertEqual(aspects.get('methodsmell'), method_smell_instance) self.assertEqual(aspects.get('TrailingPeriod'), trailing_period_instance)