コード例 #1
0
 def test_extended_letters(self):
     self.assertIn(u'\u0635', alphabet.letters_to_code.keys())
     char1 = 'ه'
     char2 = 'س'
     # note that this script is printed right to left.
     self.assertEqual(text.text_to_code(char1 + char2),
                      text.text_to_code('ES'))
コード例 #2
0
 def test_sanity(self):
     """
     make sure it's compatible with itself
     """
     code1 = text.text_to_code(self.message_text)
     text1 = text.code_to_text(code1)
     code2 = text.text_to_code(text1)
     self.assertEqual(text1, self.message_text.upper())
     self.assertEqual(code1, code2)
コード例 #3
0
 def text_to_sound(self, message_text):
     """
     Play a text string as Morse code through speakers
     """
     message_morse = text.text_to_code(message_text)
     for word in message_morse.split('  '):
         self.play_word(word)
コード例 #4
0
 def test_text_to_code(self):
     result = text.text_to_code(self.message_text)
     self.assertEqual(result, self.message_code)