def input_flask(ID0, ID1, ID2, ID3): # Establish queue q = queue.Queue(maxsize=4) thread_num = 4 # Fetch API keys ti = twitter_info('keys') q.put(ID0) q.put(ID1) q.put(ID2) q.put(ID3) # Get and convert tweets to image for i in range(thread_num): t2 = threading.Thread(name="Tweets to image", target=twit_to_image, args=( q, ti, i, )) t2.daemon = True t2.start() q.join()
def test_twit1(): n = twitter_info('keys') try: n.getting_pics("Friends") except (): assert 0 else: assert 1
def test_twit6(): n = twitter_info('keys') try: n.getting_pics("Tigers") except (): assert 0 else: assert 1
def test_twit3(): n = twitter_info('keys') try: n.getting_pics("Animals") except (): assert 0 else: assert 1
def test_twit2(): n = twitter_info('keys') try: n.getting_pics("Penguins") except (): assert 0 else: assert 1
def test_thread1(): try: q = queue.Queue(maxsize=1) # Fetch API keys ti = twitter_info('keys') q.put("Animals") # Get and convert tweets to image t2 = threading.Thread(name="Tweets to image", target=twit_to_image, args=(q,ti,1,)) t2.daemon = True t2.start() q.join() except(): assert 0 else: assert 1
def executing(): # Establish queue q = queue.Queue(maxsize=4) thread_num = 4 # Fetch API keys ti = twitter_info('keys') for i in range(thread_num): get_screen_names(q) # Get and convert tweets to image for i in range(thread_num): t2 = threading.Thread(name="Tweets to image", target=twit_to_image, args=( q, ti, i, )) t2.daemon = True t2.start() q.join()