def test_correct_word(self): sc = StubSpellChecker(('bob',)) word = Word('bOb', sc) self.assertTrue(word.misspelled) word.correct_spelling() self.assertEquals('bob', word.text) self.assertFalse(word.misspelled)
def test_correct_word(self): sc = StubSpellChecker(('bob', )) word = Word('bOb', sc) self.assertTrue(word.misspelled) word.correct_spelling() self.assertEquals('bob', word.text) self.assertFalse(word.misspelled)
def test_hyphenate_word(self): sc = StubSpellChecker(('abc-def',)) word = Word('abcAdef', sc) self.assertTrue(word.misspelled) self.assertFalse(word.hyphenated) word.hyphenate() self.assertEquals('abc-def', word.text) self.assertFalse(word.misspelled) self.assertTrue(word.hyphenated)
def test_hyphenate_word(self): sc = StubSpellChecker(('abc-def', )) word = Word('abcAdef', sc) self.assertTrue(word.misspelled) self.assertFalse(word.hyphenated) word.hyphenate() self.assertEquals('abc-def', word.text) self.assertFalse(word.misspelled) self.assertTrue(word.hyphenated)
def test_hyphen_join(self): sc = StubSpellChecker(('dob', 'bob-', 'bob-dob', )) word_one = Word('bob-', sc) word_two = Word('dob', sc) word_two.prepend(word_one) self.assertEquals('', word_one.text) self.assertEquals('bob-dob', word_two.text)
def test_hyphen_join(self): sc = StubSpellChecker(( 'dob', 'bob-', 'bob-dob', )) word_one = Word('bob-', sc) word_two = Word('dob', sc) word_two.prepend(word_one) self.assertEquals('', word_one.text) self.assertEquals('bob-dob', word_two.text)
def test_verify_word(self): sc = StubSpellChecker(('bob', 'bo-b')) word = Word('bob', sc) self.assertFalse(word.misspelled) self.assertFalse(word.odd_punctuation) self.assertFalse(word.hyphenated) word = Word('bobc', sc) self.assertTrue(word.misspelled) self.assertFalse(word.odd_punctuation) self.assertFalse(word.hyphenated) word = Word('b;ob', sc) self.assertTrue(word.misspelled) self.assertTrue(word.odd_punctuation) self.assertFalse(word.hyphenated) word = Word('bo-b', sc) self.assertFalse(word.misspelled) self.assertFalse(word.odd_punctuation) self.assertTrue(word.hyphenated)
def test_hyphen_fix(self): sc = StubSpellChecker(('bellfast', )) word_one = Word('bell', sc) word_two = Word('fast', sc) word_two.prepend(word_one) self.assertEquals('', word_one.text) self.assertEquals('bellfast', word_two.text) word_one = Word('bell-', sc) word_two = Word('fast', sc) word_two.prepend(word_one) self.assertEquals('', word_one.text) self.assertEquals('bellfast', word_two.text) word_one = Word('belle', sc) word_two = Word('fast', sc) word_two.prepend(word_one) self.assertEquals('', word_one.text) self.assertEquals('bellfast', word_two.text)