def test_english_quick_fix(self): sc = spell_checker.StubSpellChecker(['a','b','c','d',]) sc.fixer = spell_checker.EnglishSpellFixer() for test, expected in test_expected('{}/test_spellcheck/quick_fix'.format(PATH)): self.assertEqual(sc.quick_fix(test), expected) for test, expected in test_expected('{}/test_spellcheck/english_quick_fix'.format(PATH)): self.assertEqual(sc.quick_fix(test), expected)
def test_english_quick_fix(self): sc = spell_checker.StubSpellChecker([ 'a', 'b', 'c', 'd', ]) sc.fixer = spell_checker.EnglishSpellFixer() for test, expected in test_expected( '{}/test_spellcheck/quick_fix'.format(PATH)): self.assertEqual(sc.quick_fix(test), expected) for test, expected in test_expected( '{}/test_spellcheck/english_quick_fix'.format(PATH)): self.assertEqual(sc.quick_fix(test), expected)
def test_hyphenate(self): sc = spell_checker.StubSpellChecker([ 'pearl-jam', 'd-lite', 'de-lite', ]) for test, expected in test_expected('{}/test_spellcheck/hyphenate'.format(PATH)): self.assertEqual(sc.hyphenate(test), expected)
def test_hyphenate(self): sc = spell_checker.StubSpellChecker([ 'pearl-jam', 'd-lite', 'de-lite', ]) for test, expected in test_expected( '{}/test_spellcheck/hyphenate'.format(PATH)): self.assertEqual(sc.hyphenate(test), expected)
def test_odd_punctuation(self): sc = spell_checker.StubSpellChecker([ 'a', 'b', 'c', 'd', ]) for test, expected in test_expected( '{}/test_spellcheck/odd_punctuation'.format(PATH)): self.assertEqual(bool(sc.odd_punctuation(test)), bool(int(expected)), test)
def test_fix_spelling(self): sc = spell_checker.StubSpellChecker([ 'Cantrip', 'government', 'bomb', 'born', 'bod', "he'll", 'What', 'hiss', 'different', ]) for test, expected in test_expected('{}/test_spellcheck/fix_spelling'.format(PATH)): self.assertEqual(sc.fix_spelling(test), expected)
def test_fixed_words(self): sc = spell_checker.StubSpellChecker([ 'Cantrip', 'government', 'bomb', 'born', 'bod', "he'll", 'What', 'hiss', 'different', ]) db = document_builder.SpellcheckDocMaker(sc) for test, expected in test_expected('{}/test_spellcheck/fix_spelling'.format(PATH)): self.assertEqual(db.fixed_words((test,)).values()[0], [expected,])
def test_fix_spelling(self): sc = spell_checker.StubSpellChecker([ 'Cantrip', 'government', 'bomb', 'born', 'bod', "he'll", 'What', 'hiss', 'different', ]) for test, expected in test_expected( '{}/test_spellcheck/fix_spelling'.format(PATH)): self.assertEqual(sc.fix_spelling(test), expected)
def test_fixed_words(self): sc = spell_checker.StubSpellChecker([ 'Cantrip', 'government', 'bomb', 'born', 'bod', "he'll", 'What', 'hiss', 'different', ]) db = document_builder.SpellcheckDocMaker(sc) for test, expected in test_expected( '{}/test_spellcheck/fix_spelling'.format(PATH)): self.assertEqual( db.fixed_words((test, )).values()[0], [ expected, ])
def test_first_word(self): for test, expected in test_expected('first_word'): line = Line(test, 1, StubSpellChecker(())) self.assertEqual(line.first_word(), expected)
def test_odd_punctuation(self): sc = spell_checker.StubSpellChecker(['a','b','c','d',]) for test, expected in test_expected('{}/test_spellcheck/odd_punctuation'.format(PATH)): self.assertEqual(bool(sc.odd_punctuation(test)), bool(int(expected)), test)