Exemple #1
0
 def test_trim(self):
     self.assertEqual(morse.edge(1, 300), morse.trim(morse.dit() + morse.symbol_gap()))
Exemple #2
0
 def test_character(self):
     self.assertEqual(morse.dit() + morse.symbol_gap() + morse.dit() + morse.character_gap(), morse.encode_character('I'))
     self.assertRaises(morse.EncodingError, morse.encode_character, 'e')
     self.assertRaises(morse.EncodingError, morse.encode_character, ' ')
     self.assertRaises(morse.EncodingError, morse.encode_character, '%')
Exemple #3
0
 def test_word(self):
     self.assertEqual(morse.dit() + morse.character_gap() + morse.dit() + morse.symbol_gap() + morse.dit() + morse.word_gap(), morse.encode_word('EI'))
     self.assertRaises(morse.EncodingError, morse.encode_word, 'lowercase')
     self.assertRaises(morse.EncodingError, morse.encode_word, 'has space')
     self.assertRaises(morse.EncodingError, morse.encode_word, 'period.')
     self.assertRaises(morse.EncodingError, morse.encode_word, 'invalid%')
Exemple #4
0
 def test_symbol(self):
     self.assertEqual(morse.dit() + morse.symbol_gap(), morse.encode_symbol('.'))
     self.assertEqual(morse.dah() + morse.symbol_gap(), morse.encode_symbol('-'))
     self.assertRaises(morse.EncodingError, morse.encode_symbol, ' ')