interactive-coding-challenges/sorting_searching/anagrams/test_anagrams.py
2017-03-27 05:13:54 -04:00

22 lines
546 B
Python

from nose.tools import assert_equal, assert_raises
class TestAnagrams(object):
def test_group_anagrams(self):
anagram = Anagram()
assert_raises(TypeError, anagram.group_anagrams, None)
data = ['ram', 'act', 'arm', 'bat', 'cat', 'tab']
expected = ['ram', 'arm', 'act', 'cat', 'bat', 'tab']
assert_equal(anagram.group_anagrams(data), expected)
print('Success: test_group_anagrams')
def main():
test = TestAnagrams()
test.test_group_anagrams()
if __name__ == '__main__':
main()