Last active
August 29, 2015 13:57
-
-
Save mitko0003/9630747 to your computer and use it in GitHub Desktop.
It is as epic as it gets!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import solution | |
class TestFiveFunctions(unittest.TestCase): | |
def test_anagrams_0(self): | |
words = [("To be or not to be: that is the question; whether" | |
" \'tis nobler in the mind to suffer the slings and arrows" | |
" of outrageous fortune..."), | |
("In one of the Bard\'s best-thought-of tragedies our" | |
" insistent hero, Hamlet, queries on two fronts about" | |
" how life turns rotten."), "wow"] | |
anagrams = [[("To be or not to be: that is the question; whether" | |
" \'tis nobler in the mind to suffer the slings and" | |
" arrows of outrageous fortune..."), | |
("In one of the Bard\'s best-thought-of tragedies our" | |
" insistent hero, Hamlet, queries on two fronts about" | |
" how life turns rotten.")], ["wow"]] | |
self.assertEqual( | |
set(map(frozenset, anagrams)), | |
set(map(frozenset, solution.anagrams(words)))) | |
def test_anagrams_1(self): | |
words = [("To be or not to be: that is the question; whether \'tis" | |
" nobler in the mind to suffer the slings and arrows of" | |
" outrageous fortune, or to take arms against a sea of" | |
" troubles and by opposing, end them?"), | |
("Is a befitting quote from one of Shakespeare\'s greatest" | |
" tragedies. But why won\'t Hamlet\'s inspiring motto toss" | |
" our stubborn hero\'s tortuous battle for life, on one" | |
" hand, and death, on another?"), "such string"] | |
anagrams = [[("To be or not to be: that is the question; whether \'" | |
"tis nobler in the mind to suffer the slings and arrows" | |
" of outrageous fortune, or to take arms against a sea" | |
" of troubles and by opposing, end them?"), | |
("Is a befitting quote from one of Shakespeare\'s" | |
" greatest tragedies. But why won\'t Hamlet\'s inspiring" | |
" motto toss our stubborn hero\'s tortuous battle for" | |
" life, on one hand, and death, on another?")], | |
["such string"]] | |
self.assertEqual( | |
set(map(frozenset, anagrams)), | |
set(map(frozenset, solution.anagrams(words)))) | |
def test_anagrams_2(self): | |
words = ["Election results", "Stolen cruelties.", | |
"Lies – let\'s recount", "Halley\'s Comet", | |
"Shall yet come", "Conversation", | |
"Voices rant on", "Fir cones", "Conifers"] | |
anagrams = [["Election results", "Stolen cruelties.", | |
"Lies – let\'s recount"], | |
["Halley\'s Comet", "Shall yet come"], | |
["Conversation", "Voices rant on"], | |
["Fir cones", "Conifers"]] | |
self.assertEqual( | |
set(map(frozenset, anagrams)), | |
set(map(frozenset, solution.anagrams(words)))) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment