Ejemplo n.º 1
0
 def test_correct(self):
     for language, tests in self.correct_tests.items():
         try:
             self.lang_check.language = language
         except ValueError:
             version = grammar_check.get_version()
             warnings.warn(
                 'LanguageTool {} doesn’t support language {!r}'.format(
                     version, language))
         for text, result in tests.items():
             self.assertEqual(self.lang_check.correct(text), result)
Ejemplo n.º 2
0
 def test_correct(self):
     for language, tests in self.correct_tests.items():
         try:
             self.lang_check.language = language
         except ValueError:
             version = grammar_check.get_version()
             warnings.warn(
                 'LanguageTool {} doesn’t support language {!r}'
                 .format(version, language)
             )
         for text, result in tests.items():
             self.assertEqual(self.lang_check.correct(text), result)
Ejemplo n.º 3
0
 def test_check(self):
     for language, tests in self.check_tests.items():
         try:
             self.lang_check.language = language
         except ValueError:
             version = grammar_check.get_version()
             warnings.warn(
                 'LanguageTool {} doesn’t support language {!r}'.format(
                     version, language))
         for text, expected_matches in tests:
             matches = self.lang_check.check(text)
             for expected_match in expected_matches:
                 for match in matches:
                     if ((match.fromy, match.fromx,
                          match.ruleId) == (expected_match.fromy,
                                            expected_match.fromx,
                                            expected_match.ruleId)):
                         break
                 else:
                     raise IndexError(
                         'can’t find {!r}'.format(expected_match))
Ejemplo n.º 4
0
 def test_check(self):
     for language, tests in self.check_tests.items():
         try:
             self.lang_check.language = language
         except ValueError:
             version = grammar_check.get_version()
             warnings.warn(
                 'LanguageTool {} doesn’t support language {!r}'
                 .format(version, language)
             )
         for text, expected_matches in tests:
             matches = self.lang_check.check(text)
             for expected_match in expected_matches:
                 for match in matches:
                     if (
                         (match.fromy, match.fromx, match.ruleId) ==
                         (expected_match.fromy, expected_match.fromx,
                          expected_match.ruleId)
                     ):
                         break
                 else:
                     raise IndexError(
                         'can’t find {!r}'.format(expected_match))
Ejemplo n.º 5
0
 def test_version(self):
     version = grammar_check.get_version()
     self.assertTrue(version)
Ejemplo n.º 6
0
 def test_version(self):
     version = grammar_check.get_version()
     self.assertTrue(version)