예제 #1
0
class WordBuilderTest(unittest.TestCase):
    def setUp(self):
        self.word_builder = WordBuilder(["abba"])

    def test_add_nonalpha(self):
        word = "abba"
        chars = ["a", "b", "!"]  # alphabetic  # non-alphabetic
        new_word = self.word_builder.add_nonalpha(word, chars, count=2)
        symbols = [c for c in new_word if c in "!"]
        alphas = [c for c in new_word if c in "ab"]
        self.assertEqual(len(symbols), 2)
        self.assertEqual(len(alphas), 4)
        self.assertEqual("".join(alphas), "abba")
예제 #2
0
 def setUp(self):
     self.word_builder = WordBuilder(["abba"])