def memepie(): if 'meme' in request.values: meme = Meme(request.values['meme']) if meme.is_valid(): twitter = Twitter() parser = Parser() texts = twitter.get_sources(meme, 20) #from source import Source #texts = [Source("", "x is my middle name",""), Source("", "y is my middle name", ""), Source("", "x is my middle name","")] result = parser.collate_words(meme, texts) gchart = GChart() g.clean_query = meme.get_clean_meme() g.meme_exceptions = meme.get_exceptions() g.meme_parts = meme.get_parts() g.pie_data = gchart.generate_pie_data(result) #first_word_source_list = result.get_source_list(result.get_list()[0][0]) return render_template("memepie.htm") else: g.clean_query = meme.get_clean_meme() #our understanding of meme g.error_message = meme.get_problem() return render_template("error.htm")
def test_get_parts_valid_3(self): m = Meme("foo * bar") self.assertEqual(m.get_parts(), ["foo", "bar"])
def test_get_parts_valid_2(self): m = Meme("foo *") self.assertEqual(m.get_parts(), ["foo", ""])
def test_get_parts_valid_1(self): m = Meme("* foo") self.assertEqual(m.get_parts(), ["", "foo"])