pprint(trends) if not trends: sys.exit("Nowt found, try later") for trend in trends: intext = trend outtext = schpy.topic_schmopic(trend) if outtext: break else: sys.exit("no output for " + intext + ", find another") if not outtext: sys.exit("Nowt found, try later") tweet = schpy.print_result(intext, outtext) print("Tweet this:\n", tweet) try: tweet_it(tweet) saved_trends.append(intext) save_list(args.cache, saved_trends) except twitter.api.TwitterHTTPError as e: print("*"*80) print(e) print("*"*80) # End of file
def test_print_result(self): in_intext = "bot" in_outtext = "schmot" out_outtext = schpy.print_result(in_intext, in_outtext) self.assertIn("bot? schmot", out_outtext)