mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
Make test_emoji about 500ms faster.
The test_emoji test makes sure that we build the correct image tag for all of our emojis. It's the same underlying algorithm for all 800+ images, so we now test it in O(1) times instead of O(N) time. Randomly sampling the emojis makes the tests slightly non-determinisitic in a theoretical sense, but not in a practical sense. (imported from commit c78b50072953f2c081fca0272b9ecf762a4802db)
This commit is contained in:
@@ -2274,8 +2274,11 @@ xxxxxxx</strong></p>\n<p>xxxxxxx xxxxx xxxx xxxxx:<br>\n<code>xxxxxx</code>: xxx
|
||||
(':even faker smile:', ':even faker smile:'),
|
||||
]
|
||||
|
||||
# Check every single emoji
|
||||
for img in bugdown.emoji_list:
|
||||
# Check a random sample of our 800+ emojis to make
|
||||
# sure that bugdown builds the correct image tag.
|
||||
emojis = bugdown.emoji_list
|
||||
emojis = random.sample(emojis, 15)
|
||||
for img in emojis:
|
||||
emoji_text = ":%s:" % img
|
||||
test_cases.append((emoji_text, emoji_img(emoji_text)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user