forked from OmkarPathak/pygorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_string.py
More file actions
34 lines (27 loc) · 1.06 KB
/
test_string.py
File metadata and controls
34 lines (27 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import unittest
from pygorithm.strings import (
anagram,
isogram,
pangram,
manacher_algorithm,
palindrome)
class TestAnagram(unittest.TestCase):
def test_anagram(self):
self.assertEqual(anagram.is_anagram('ant', ['tan', 'stand', 'at']), ['tan'])
class TestPangram(unittest.TestCase):
def test_pangram(self):
self.assertTrue(pangram.is_pangram('the quick brown fox jumps over the lazy dog'))
self.assertFalse(pangram.is_pangram('omkar'))
class TestIsogram(unittest.TestCase):
def test_isogram(self):
self.assertTrue(isogram.is_isogram('isogram'))
self.assertFalse(isogram.is_isogram('eleven'))
class TestPalindrome(unittest.TestCase):
def test_palindrome(self):
self.assertTrue(palindrome.is_palindrome('madam'))
self.assertFalse(palindrome.is_palindrome('eleven'))
class TestManacherAlgorithm(unittest.TestCase):
def test_manacher_algorithm(self):
self.assertEqual(manacher_algorithm.manacher('babcbabcbaccba'), 'abcbabcba')
if __name__ == '__main__':
unittest.main()