def test_all_emoji(): all_emoji = Emojipedia.all() assert len(all_emoji) >= 2621 for e in all_emoji: # Test private properties so we don't scrape Emojipedia # if this fails assert e._title assert e._character assert e._codepoints
password=db_config['password'], database=db_config['database'], use_unicode=True, charset="utf8mb4") cursor = db_conn.cursor() cursor.execute('SET NAMES utf8mb4') cursor.execute("SET CHARACTER SET utf8mb4") cursor.execute("SET character_set_connection=utf8mb4") with open('Output/method2_insert_emoji.sql', 'w', encoding='utf-8') as db_file: # ------- SCRAPE EMOJI ------- print("Scraping Emoji by Emojipedia.all()") scraped_emoji = Emojipedia.all() emoji_id = 1 # ------- PERSIST EMOJI & UNICODE ------- print("Persisting Emoji") for current_emoji in scraped_emoji: # not everything kicked back is actually an emoji, double checking try: image_url = current_emoji.platforms[0].image_url cur_emoji_unicode = [] for unicode in current_emoji.codepoints: cur_emoji_unicode.append(unicode) if len(cur_emoji_unicode) == 0: continue except: