Example #1
0
 def test_sentence_with_lowering_scoring_rebus(self):
     output = Sentence(Rebus(':love', 'so', 'o'),
                       Rebus(':house', 'ti', 'oue'),
                       Rebus(':rake', 'wo', 'ae'),
                       Rebus(':ear', 'he', 'a'))
     self.assertEqual(str(output), "solve this work here")
     self.assertEqual(output.score, 31)
Example #2
0
 def test_sentence_with_higher_scoring_rebus(self):
     output = Sentence(Rebus(':dove', 'sl', 'd'),
                       Rebus(':tie', 'hs', 'e'),
                       Rebus(':book', 'wr', 'bo'),
                       Rebus(':bee', 'hr', 'b'))
     self.assertEqual(str(output), "solve this work here")
     self.assertEqual(output.score, 57)
Example #3
0
class TestReplaceLetters(unittest.TestCase):
    def setUp(self):
        self.r = Rebus("")

    def test_replace_letters_normal(self):
        word = self.r.replace_letters("dove", "de")
        self.assertEqual(str(word), "ov")

    def test_replace_letters_for_whole_word(self):
        word = self.r.replace_letters("dove", "dove")
        self.assertEqual(str(word), "")
Example #4
0
class TestReplaceLetters(unittest.TestCase):

    def setUp(self):
        self.r = Rebus('')

    def test_replace_letters_normal(self):
        word = self.r.replace_letters('dove', 'de')
        self.assertEqual(str(word), 'ov')

    def test_replace_letters_for_whole_word(self):
        word = self.r.replace_letters('dove', 'dove')
        self.assertEqual(str(word), '')
Example #5
0
class TestWordPermutations(unittest.TestCase):
    def setUp(self):
        self.r = Rebus("")

    def test_permutations_for_dove(self):
        output = self.r.word_permutations("do", "ve")
        assert "dove" in output

    def test_permutations_for_work(self):
        output = self.r.word_permutations("rk", "wo")
        assert "work" in output

    def test_permutations_for_solved(self):
        output = self.r.word_permutations("lve", "so")
        assert "solve" in output

    def test_permutations_for_this(self):
        output = self.r.word_permutations("hs", "ti")
        assert "this" in output

    def test_permutations_for_here(self):
        output = self.r.word_permutations("er", "he")
        assert "here" in output
Example #6
0
class TestWordPermutations(unittest.TestCase):

    def setUp(self):
        self.r = Rebus('')

    def test_permutations_for_dove(self):
        output = self.r.word_permutations('do', 've')
        assert 'dove' in output

    def test_permutations_for_work(self):
        output = self.r.word_permutations('rk', 'wo')
        assert 'work' in output

    def test_permutations_for_solved(self):
        output = self.r.word_permutations('lve', 'so')
        assert 'solve' in output

    def test_permutations_for_this(self):
        output = self.r.word_permutations('hs', 'ti')
        assert 'this' in output

    def test_permutations_for_here(self):
        output = self.r.word_permutations('er', 'he')
        assert 'here' in output
Example #7
0
 def setUp(self):
     self.r = Rebus('')
Example #8
0
 def test_rebus_all_the_way_down(self):
     output = Rebus(':dove', Rebus(':castle', subtract=Rebus(':cat')),
                             Rebus(':badge', subtract=Rebus(':bag')))
     self.assertEqual(str(output), 'solve')
Example #9
0
 def test_rebus_of_rebus_to_solve(self):
     output = Rebus(':dove', Rebus(':castle', subtract=':cat'),
                             Rebus(':badge', subtract=':bag'))
     self.assertEqual(str(output), 'solve')
Example #10
0
 def test_dove_image_rebus_to_solve(self):
     output = Rebus('dove_symbol.png', 'sl', 'd')
     self.assertEqual(str(output), 'solve')
Example #11
0
 def test_dove_rebus_to_solve(self):
     output = Rebus(':dove', 'sl', 'd')
     self.assertEqual(str(output), 'solve')
Example #12
0
 def setUp(self):
     self.r = Rebus("")