|
23 | 23 | strip_url_params1, strip_url_params2, strip_url_params3, |
24 | 24 | is_valid_coordinates_0, is_valid_coordinates_1, |
25 | 25 | is_valid_coordinates_regular_expression, |
26 | | - word_squares |
| 26 | + word_squares, |
| 27 | + convert_morse_word, unique_morse, |
| 28 | + judge_circle, |
| 29 | + strong_password |
27 | 30 | ) |
28 | 31 |
|
29 | 32 | import unittest |
@@ -291,7 +294,7 @@ def test_pythonic(self): |
291 | 294 | self.assertEqual("ereht olleh", pythonic("hello there")) |
292 | 295 | def test_ultra_pythonic(self): |
293 | 296 | self.assertEqual("ereht olleh", ultra_pythonic("hello there")) |
294 | | - |
| 297 | + |
295 | 298 |
|
296 | 299 | class TestReverseVowel(unittest.TestCase): |
297 | 300 | """[summary] |
@@ -381,6 +384,22 @@ def test_word_squares(self): |
381 | 384 | self.assertEqual([['wall', 'area', 'lead', 'lady'], ['ball', 'area', 'lead', 'lady']], \ |
382 | 385 | word_squares(["area","lead","wall","lady","ball"])) |
383 | 386 |
|
| 387 | +class TestUniqueMorse(unittest.TestCase): |
| 388 | + def test_convert_morse_word(self): |
| 389 | + self.assertEqual("--...-.", convert_morse_word("gin")) |
| 390 | + self.assertEqual("--...--.", convert_morse_word("msg")) |
| 391 | + def test_unique_morse(self): |
| 392 | + self.assertEqual(2, unique_morse(["gin", "zen", "gig", "msg"])) |
| 393 | + |
| 394 | +class TestJudgeCircle(unittest.TestCase): |
| 395 | + def test_judge_circle(self): |
| 396 | + self.assertTrue(judge_circle("UDLRUD")) |
| 397 | + self.assertFalse(judge_circle("LLRU")) |
| 398 | + |
| 399 | +class TestStrongPassword(unittest.TestCase): |
| 400 | + def test_strong_password(self): |
| 401 | + self.assertEqual(3, strong_password(3,"Ab1")) |
| 402 | + self.assertEqual(1, strong_password(11,"#Algorithms")) |
384 | 403 |
|
385 | 404 | if __name__ == "__main__": |
386 | 405 | unittest.main() |
0 commit comments