示例#1
0
    def test__set_section_language_wrong_language(self):
        self.section['language'] = 'INVALID_LANGUAGE'

        logger = logging.getLogger()
        with self.assertLogs(logger, 'WARNING') as cm:
            _set_section_language(self.sections)
            self.assertRegex(
                cm.output[0],
                'Section `language section` contain invalid language setting. '
                '\'Language `INVALID_LANGUAGE` is not a valid language name or '
                'not recognized by coala.\'')
            self.assertIsNone(self.section.language)
    def test__set_section_language_wrong_language(self):
        self.section['language'] = 'INVALID_LANGUAGE'

        logger = logging.getLogger()
        with self.assertLogs(logger, 'WARNING') as cm:
            _set_section_language(self.sections)
            self.assertRegex(
                cm.output[0],
                'Section `language section` contain invalid language setting. '
                '\'Language `INVALID_LANGUAGE` is not a valid language name or '
                'not recognized by coala.\'')
            self.assertIsNone(self.section.language)
示例#3
0
 def test__set_section_language_no_language(self):
     self.section['language'] = ''
     _set_section_language(self.sections)
     self.assertIsNone(self.section.language)
示例#4
0
 def test__set_section_language(self):
     _set_section_language(self.sections)
     self.assertIsInstance(self.section.language, Language)
     self.assertEqual(str(self.language), str(self.section.language))
 def test__set_section_language_no_language(self):
     self.section['language'] = ''
     _set_section_language(self.sections)
     self.assertIsNone(self.section.language)
 def test__set_section_language(self):
     _set_section_language(self.sections)
     self.assertIsInstance(self.section.language, Language)
     self.assertEqual(str(self.language), str(self.section.language))